Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- $(function() {
- $("#uploader").File({
- // General settings
- runtimes : 'flash,html5,browserplus,silverlight,gears,html4',
- url : '../upload.php',
- max_file_size : '1000mb',
- max_file_count: 20, // user can add no more then 20 files at a time
- chunk_size : '1mb',
- unique_names : true,
- multiple_queues : true,
- // Resize images on clientside if we can
- resize : false,
- // Rename files by clicking on their titles
- rename: false,
- // Sort files
- sortable: false,
- // Specify what files to browse for
- filters : [
- {title : "Image files", extensions : "jpg,gif,png"},
- {title : "Zip files", extensions : "zip,avi,mkv"}
- ],
- // Flash settings
- flash_swf_url : '../../js/File.flash.swf',
- // Silverlight settings
- silverlight_xap_url : '../../js/File.silverlight.xap'
- });
- // Client side form validation
- $('form').submit(function(e) {
- var uploader = $('#uploader').File('getUploader');
- // Files in queue upload them first
- if (uploader.files.length > 0) {
- // When all files are uploaded submit form
- uploader.bind('StateChanged', function() {
- if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {
- $('form')[0].submit();
- }
- });
- uploader.start();
- } else
- alert('You must at least upload one file.');
- return false;
- });
- });
- </script>
Add Comment
Please, Sign In to add comment