Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ Page Language="C#" AutoEventWireup="True" %>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
- <!-- MAKE SURE TO REFERENCE THIS FILE! -->
- <script type="text/javascript" src="scripts/ajaxupload.js"></script>
- <!-- END REQUIRED JS FILES -->
- <script language="C#" runat="server">
- protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) {
- if (filename.FileBytes.Length > 2097152) {
- args.IsValid = false;
- upload_area.InnerHtml = "<img src=\"/php_ajax_image_upload/images/error.gif\" width=\"16px\" height=\"16px\" border=\"0\" style=\"marin-bottom: -3px;\" /> Error(s) Found: File size is too big,<br /><br />Contact Adolf1994 with problems";
- } else {
- args.IsValid = true;
- }
- }
- </script>
- <!-- THIS CSS MAKES THE IFRAME NOT JUMP -->
- <style type="text/css">
- iframe {
- display:none;
- }</style>
- <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
- <script type="text/javascript">
- <!--
- if (top.location.href != self.location.href)
- top.location.href = self.location.href;
- //-->
- </script>
- <script type="text/javascript">
- <!--
- $(document).ready(function(){
- $(".msg_body").hide();
- $(".msg_head").click(function() {
- $(this).next(".msg_body").slideToggle(125).siblings(".msg_body").slideUp(125);
- });
- });
- //-->
- </script>
- <link href="css/styles.css" rel="stylesheet" type="text/css" media="all" />
- <style rel="stylesheet" type="text/css" media="all">
- td {
- font-size: 13px;
- font-family:Verdana, Tahoma, Arial, Helvetica, sans-serif;
- }
- .msg_list {
- margin: 0px auto;
- cursor: pointer;
- position: relative;
- right: 45px;
- padding: 0px;
- width: 350px;
- }
- .msg_head {
- padding: 5px 10px;
- cursor: pointer;
- background-color: rgb(105, 215, 255);
- margin:1px;
- text-align: center;
- }
- .msg_body {
- margin: 1px;
- cursor: default;
- padding: 5px 10px 10px;
- background-color:#F4F4F8;
- }</style>
- </head>
- <body>
- <div id="container"><!-- THIS IS THE IMPORTANT STUFF! -->
- <div id="demo_area">
- <div id="left_col">
- <fieldset>
- <legend>Upload form</legend>
- <form action="scripts/ajaxupload.php" method="post" name="standard_use" id="standard_use" enctype="multipart/form-data" runat="server">
- <input name="maxSize" value="2097152" type="hidden" />
- <input name="fullPath" value="http://adolf94.x10.mx/xfx10/" type="hidden" />
- <input name="relPath" value="../../xfx10/" type="hidden" />
- <p><asp:FileUpload name="filename" id="filename" runat="server" value="filename" size="30" /></p>
- <p style="position: relative; width: 328px; padding: 5px 10px; background-color: #FFCCCC; margin:1px; text-align: center;">Maximum allowed filesize is 2 MB</p>
- <span><button onclick="ajaxUpload(this.form,'scripts/ajaxupload.php?filename=filename&maxSize=2097152&maxW=1280&fullPath=http://adolf94.x10.mx/xfx10/&relPath=../../xfx10/&maxH=1024','upload_area','File Uploading Please Wait...<br /><img src=\'images/loader_light_blue.gif\' width=\'128\' height=\'15\' border=\'0\' />','<img src=\'images/error.gif\' width=\'16\' height=\'16\' border=\'0\' /> Error in Upload, check settings and path info in source code.'); return false;">Upload Image</button></span>
- <br /><br /><br /><div class="msg_list">
- <p class="msg_head">Click here <u>ONLY</u> if the button above doesn't work</p>
- <div class="msg_body" style="text-align: center"><input name="submit" value="Upload Image" type="submit" /></div>
- <p class="msg_head">Maximum width and height</p>
- <div class="msg_body">
- <center><table>
- <tr><td>Width:</td><td> </td><td><input name="maxW" value="1280" type="text" readonly size="4"/></td><td> </td><td>Height:</td><td> </td><td><input name="maxH" value="1024" type="text" readonly size="4"/></td></tr>
- </table></center>
- </div>
- </div>
- </form>
- </fieldset><br />
- <small style="font-weight: bold; font-style: italic">Supported File Types: gif, jpg, jpeg, png, bmp</small></div>
- <div id="right_col">
- <div id="upload_area">
- <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="filename" ErrorMessage="File size should not be greater than 2 MB." OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
- Images will be displayed here<br />
- <br />
- You can direct them to do any thing you want!</div>
- Check the images out <a href="../../xfx10/" onclick="window.open(this.href);return false;">HERE</a>!</div>
- <div class="clear"> </div></div><!-- END IMPORTANT STUFF --></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement