blueimp

Jquery file upload plugin: how to validate files on add?

青春壹個敷衍的年華 提交于 2019-11-27 20:22:33
问题 $('#fileupload') .fileupload({ acceptFileTypes: /(\.|\/)(jpg)$/i }) .on('fileuploadadd', function (e, data) { console.log(data.files.valid); //undefined setTimeout(function () { console.log(data.files.valid); //true or false }, 500); }) ; jsFiddle How to get boolean value of property data.files.valid without timeout ? 回答1: Here is what you want to do: $('#fileupload') .fileupload({ acceptFileTypes: /(\.|\/)(jpg)$/i }) .bind('fileuploadadded', function (e, data) { console.log(data.files.valid)

maxFileSize and acceptFileTypes in blueimp file upload plugin do not work. Why?

☆樱花仙子☆ 提交于 2019-11-27 16:52:30
I'm using Blueimp jQuery file upload plugin for upload files. I had no problem in uploading but the option maxFileSize and acceptFileTypes do not work. This is my code: $(document).ready(function () { 'use strict'; $('#fileupload').fileupload({ dataType: 'json', autoUpload: false, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, maxFileSize: 5000000, done: function (e, data) { $.each(data.result.files, function (index, file) { $('<p style="color: green;">' + file.name + '<i class="elusive-ok" style="padding-left:10px;"/> - Type: ' + file.type + ' - Size: ' + file.size + ' byte</p>') .appendTo('

maxFileSize and acceptFileTypes in blueimp file upload plugin do not work. Why?

让人想犯罪 __ 提交于 2019-11-27 04:09:50
问题 I'm using Blueimp jQuery file upload plugin for upload files. I had no problem in uploading but the option maxFileSize and acceptFileTypes do not work. This is my code: $(document).ready(function () { 'use strict'; $('#fileupload').fileupload({ dataType: 'json', autoUpload: false, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, maxFileSize: 5000000, done: function (e, data) { $.each(data.result.files, function (index, file) { $('<p style="color: green;">' + file.name + '<i class="elusive-ok"

jQuery FileUpload doesn't trigger 'done'

我只是一个虾纸丫 提交于 2019-11-27 03:48:33
问题 I use jQuery-File-Upload plugin. I wrote a simple code to test it - and it works, but not without problems. It doesn't trigger done , even if the file is uploaded and progress bar reached its end. Here's the code: $('#file_file').fileupload({ dataType: 'json', autoUpload: true, add: function (e, data) { data.context = $('<p/>').text('Uploading...').appendTo(document.body); data.submit(); }, progressall: function (e, data) { var progress = parseInt(data.loaded / data.total * 100, 10); $('

How to upload a file only once with blueimp file upload plugin?

為{幸葍}努か 提交于 2019-11-27 02:47:49
问题 I'm using the bluimp jQuery-File-Upload-plugin . It's no problem to select some files and upload them, but when I want to upload another files without refreshing the page, the first ones are getting uploaded again. My question is how can I "unset" files after they are uploaded. Here is my sourcecode Javascript: $('#MappeFile').fileupload({ dataType : 'json', autoUpload : false, maxNumberOfFiles : undefined, maxFileSize : 6000000, minFileSize : undefined, acceptFileTypes : /.+$/i, url : "/ajax

blueImp/jquery file upload - How do I get the error message if the file type was not accepted?

故事扮演 提交于 2019-11-26 23:00:45
问题 I want to use the BlueImp/Jquery File Upload to be able to upload some images to web webserver. I have this JS code which I generated by reading many sources $('#file_upload').fileupload('option', { dataType: 'json', url: '/Upload/UploadFiles', maxFileSize: 5000000, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, process: [ { action: 'load', fileTypes: /^image\/(gif|jpeg|png)$/, maxFileSize: 20000000 // 20MB }, { action: 'resize', maxWidth: 1440, maxHeight: 900 }, { action: 'save' } ],

jQuery File Upload Plugin: Is possible to preserve the structure of uploaded folders?

☆樱花仙子☆ 提交于 2019-11-26 18:01:42
I am trying this plugin ( https://github.com/blueimp/jQuery-File-Upload ) and interesting in folder upload. I wonder if the plugin is able to preserve the structure of uploaded subfolders (= uploading 1 folder with 3 subfolder, each containing several files)? guest271314 This should be possible at webkit browsers using drag-and-drop .dataTransfer object at drop event; .webkitGetAsEntry() ; webkitRequestFileSystem getDirectory() to create directory having same name as uploaded folder, .createReader() on DirectoryEntry , readEntries() to iterate entries in directory, call .copyTo() for each

jQuery File Upload Plugin: Is possible to preserve the structure of uploaded folders?

a 夏天 提交于 2019-11-26 06:08:48
问题 I am trying this plugin (https://github.com/blueimp/jQuery-File-Upload) and interesting in folder upload. I wonder if the plugin is able to preserve the structure of uploaded subfolders (= uploading 1 folder with 3 subfolder, each containing several files)? 回答1: This should be possible at webkit browsers using drag-and-drop .dataTransfer object at drop event; .webkitGetAsEntry() ; webkitRequestFileSystem getDirectory() to create directory having same name as uploaded folder, .createReader()