Advertisement
Guest User

jquery-file-upload

a guest
Apr 23rd, 2012
569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.96 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3.     <head>
  4.         <meta charset="utf-8">
  5.         <title>jQuery File Upload Example</title>
  6.         <link rel="stylesheet" href="http://blueimp.github.com/cdn/css/bootstrap.min.css">
  7.         <!-- Generic page styles -->
  8.  
  9.         <!-- Bootstrap styles for responsive website layout, supporting different screen sizes -->
  10.         <link rel="stylesheet" href="http://blueimp.github.com/cdn/css/bootstrap-responsive.min.css">
  11.         <!-- Bootstrap CSS fixes for IE6 -->
  12.         <!--[if lt IE 7]><link rel="stylesheet" href="http://blueimp.github.com/cdn/css/bootstrap-ie6.min.css"><![endif]-->
  13.         <!-- Bootstrap Image Gallery styles -->
  14.         <link rel="stylesheet" href="http://blueimp.github.com/Bootstrap-Image-Gallery/css/bootstrap-image-gallery.min.css">
  15.         <!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
  16.         <link rel="stylesheet" href="css/jquery.fileupload-ui.css">
  17.     </head>
  18. <?php
  19.  
  20. if(($_FILES))
  21.     var_dump($_FILES);
  22. else echo "Nothing";
  23.  
  24. ?>
  25.  
  26.  
  27.     <body>
  28.         <form id="myform" method="post" enctype="multipart/form-data">
  29.             <span class="btn btn-success btn-mini fileinput-button">
  30.                 <i class="icon-plus icon-white"></i>
  31.                 <span>Add files</span>
  32.                 <input  id="fileupload" type="file" name="files[]" multiple>
  33.             </span>
  34.             <button type="submit" id="start_uploads">Start uploads</button>
  35.         </form>
  36.         <ul id="fileList">
  37.          </ul>  
  38.         <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  39.         <script src="js/vendor/jquery.ui.widget.js"></script>
  40.         <script src="js/jquery.iframe-transport.js"></script>
  41.         <script src="js/jquery.fileupload.js"></script>
  42.         <script src="js/jquery.fileupload-ui.js"></script>
  43.         <script>
  44.             $(function () {
  45.                
  46.                                 $('#fileupload').fileupload({
  47.                                     dataType: 'json',
  48.                                     add: function (e, data) {
  49.                                         $.each(data.files, function (index, file) {
  50.                                                 //alert('Added file: ' + file.name);
  51.                                                 $('<li/>').text(file.name).appendTo('#fileList');
  52.                                             });
  53.                                         return true;
  54.                                     },
  55.  
  56.                                 });
  57.  
  58.                                 //$('#myform').bind('submit',function(){$('#fileupload').send()});
  59.                            
  60.  
  61.  
  62.                 //$('#start_uploads').click(function () {
  63.                  //               $('.file_upload_start button').click();
  64.                  //               return false;
  65.                  //           });
  66.                
  67.  
  68.                
  69.             });
  70.         </script>
  71.     </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement