Uploadify – Limit to One Upload Only

Hey everyone,

Just a quick post detailing how to limit uploadify to a single file. Simply add the following settings to your uploadify initialisation:

multi: false
queueSizeLimit : 1
uploadLimit : 1

  1.  
  2. $(document).ready(function() {
  3.      $('#file_upload').uploadify({
  4.         'swf' : '<?php echo $this->Html->url('/uploadify/uploadify.swf');?>',
  5. 	'uploader' : '<?php echo $this->Html->url('/uploadify/uploadify.php');?>',
  6. 	'cancelImg' : '<?php echo $this->Html->url('/webroot/uploadify/cancel.png');?>',
  7. 	'folder' : '<?php echo $this->Html->url('/extraz/uploaded_by_all_users');?>',
  8. 	'auto' : true,
  9. 	'buttonText' : 'Browse',
  10. 	'multi' : false,
  11. 	'queueSizeLimit' : 1,
  12. 	'uploadLimit' : 1,
  13. 	'sizeLimit' : 1073741824,
  14. 	'debug' : true,
  15. 	'multi' : false,	        
  16. 	'onUploadProgress' : upload_progress_handler,
  17. 	'onUploadStart' : upload_start_handler,
  18. 	'onUploadSuccess' : on_upload_success,
  19. 	'onUploadError' : on_upload_error
  20.      });
  21. });

Once the upload limit is exceeded the onUploadError event is raised.

Cheers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.