Advertisement
Guest User

Form

a guest
Mar 23rd, 2011
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.60 KB | None | 0 0
  1. <?php
  2.  
  3.     //Expire headers
  4.     header('Expires: Tue, 08 Oct 1991 00:00:00 GMT');
  5.     header('Cache-Control: no-cache, must-revalidate');
  6.  
  7. ?>
  8. <!doctype html>
  9. <!--[if lt IE 7 ]><html lang=en-us class="no-js ie6"><![endif]-->
  10. <!--[if IE 7 ]><html lang=en-us class="no-js ie7"><![endif]-->
  11. <!--[if IE 8 ]><html lang=en-us class="no-js ie8"><![endif]-->
  12. <!--[if (gte IE 9)|!(IE)]><!--> <html lang=en-us class=no-js> <!--<![endif]-->
  13.     <head>
  14.         <meta charset=utf-8>
  15.         <meta http-equiv=X-UA-Compatible content="IE=Edge;chrome=1">
  16.         <title>Test para el maldito upload form</title>
  17.         <style>
  18.             style{
  19.                 display: block;
  20.                 float: right;
  21.                 background: #444;
  22.             }
  23.         </style>
  24.     </head>
  25.     <body>
  26.  
  27.         <div style="float: left; margin-right: 100px;">
  28.         <?php
  29.            
  30.             //Unique ID
  31.             $uid = md5(uniqid(rand()));
  32.  
  33.             if ($_FILES){
  34.                 echo "<pre>";
  35.                 var_dump($_FILES);
  36.                 echo "</pre>";
  37.             }
  38.            
  39.         ?>
  40.         </div>
  41.        
  42.         <form action="" method="post" enctype="multipart/form-data" name="upload" id="upload">
  43. <?php
  44.  
  45.     echo "UID: ".$uid."<br>";
  46.  
  47. ?>
  48.             <input type="hidden" name="APC_UPLOAD_PROGRESS" id="progress_key" value="<?php echo $uid; ?>" />
  49.             <input type="file" name="file" id="file" /> <br>
  50.             <input type="submit" /><br>
  51.  
  52.             <iframe
  53.                 width="400px"
  54.                 height="400px"
  55.                 frameborder="1"
  56.                 src=""
  57.                 id="upload_frame"
  58.                 name="upload_frame"></iframe>
  59.  
  60.         </form>
  61.  
  62.         <pre><style contenteditable>
  63.             body{
  64.                 background-color: #444;
  65.                 color: white;
  66.             }  
  67.             form{
  68.                 border: 1px solid white;
  69.                 padding: 30px;
  70.                 float: left;
  71.             }
  72.             p.debug{
  73.                 background-color: yellow;
  74.                 color: black;
  75.             }
  76.         </style></pre>
  77.    
  78.         <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.js" type="text/javascript"></script>
  79.         <script>
  80.             $("#upload").submit(function(){
  81.                 console.log("onSubmit event!");
  82.                 function set(){
  83.                     $("#upload_frame").attr("src", "/tmp/progress.php?uid=<?php echo $uid; ?>");
  84.                 }
  85.                 setTimeout(set);
  86.             });
  87.         </script>
  88.  
  89.     </body>
  90. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement