Guest User

Untitled

a guest
Jan 19th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2. $(function() {
  3. $("#uploader").File({
  4. // General settings
  5. runtimes : 'flash,html5,browserplus,silverlight,gears,html4',
  6. url : '../upload.php',
  7. max_file_size : '1000mb',
  8. max_file_count: 20, // user can add no more then 20 files at a time
  9. chunk_size : '1mb',
  10. unique_names : true,
  11. multiple_queues : true,
  12.  
  13. // Resize images on clientside if we can
  14. resize : false,
  15.  
  16. // Rename files by clicking on their titles
  17. rename: false,
  18.  
  19. // Sort files
  20. sortable: false,
  21.  
  22. // Specify what files to browse for
  23. filters : [
  24. {title : "Image files", extensions : "jpg,gif,png"},
  25. {title : "Zip files", extensions : "zip,avi,mkv"}
  26. ],
  27.  
  28. // Flash settings
  29. flash_swf_url : '../../js/File.flash.swf',
  30.  
  31. // Silverlight settings
  32. silverlight_xap_url : '../../js/File.silverlight.xap'
  33. });
  34.  
  35. // Client side form validation
  36. $('form').submit(function(e) {
  37. var uploader = $('#uploader').File('getUploader');
  38.  
  39. // Files in queue upload them first
  40. if (uploader.files.length > 0) {
  41. // When all files are uploaded submit form
  42. uploader.bind('StateChanged', function() {
  43. if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {
  44. $('form')[0].submit();
  45. }
  46. });
  47.  
  48. uploader.start();
  49. } else
  50. alert('You must at least upload one file.');
  51.  
  52. return false;
  53. });
  54.  
  55.  
  56. });
  57. </script>
Add Comment
Please, Sign In to add comment