jquery-file-upload

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)

jQuery File Upload preview image

三世轮回 提交于 2019-11-27 20:14:50
问题 I am using jQuery File Upload plugin (http://blueimp.github.io/jQuery-File-Upload/) for image upload for my website. I have look through (https://github.com/blueimp/jQuery-File-Upload/wiki/Options), but I didn't find the setting to assign an element to display the image. So, how can I preview the image on the webpage with this plugin? Thank you. 回答1: I don't think that the Jquery File Upload plugin provides preview functionality. But you can easily implement it into the plugin's add option:

Setting the Content-Type in direct to S3 upload using Rails and jQuery File Upload

喜夏-厌秋 提交于 2019-11-27 18:10:32
问题 I've seen many questions here on this topic but nothing I've come across has worked for me, so here I am posting another... I'm on Ruby on Rails trying to configure file uploads direct to Amazon S3 using the jQuery File Upload plugin. I followed along with the very helpful Heroku tutorial to get the initial setup working. Files uploaded fine, but they were all labeled as Content-Type: binary/octet-stream in S3, so when they were served in the app, all files would download instead of opening

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('

Can someone explain how to implement the jQuery File Upload plugin?

强颜欢笑 提交于 2019-11-27 10:05:44
EDIT: This still seems to be getting traffic so I'll explain what I ended up doing. I eventually got the plugin working by following Subrat's tutorial, which is the accepted answer. However, jQuery File Upload is a real hassle, and if you're looking for a simple file upload plugin, I would highly recommend Uploadify (thanks, CORSAIR!). As an answer pointed out, it is only free for non-commercial use. Background I'm trying to use blueimp's jQuery File Upload to allow users to upload files. Out of the box it works perfectly , following the setup instructions. But to use it practically on my

Show a progress on multiple file upload Jquery/Ajax

只谈情不闲聊 提交于 2019-11-27 09:29:45
问题 I have upload form that allows users to upload multiple files. I decided that a progress bar would be good if the files are quite large. Below is my source code. I am new to jquery normally I would just php but I find that ajax is more user friendly. <div id="new_upload"> <div class="close_btn"></div> <div id="uploads"></div> <form action="global.func/file_upload.php" method="post" enctype="multipart/form-data" id="upload_file"> <fieldset><legend>Upload an image or video</legend> <input type=

Uploading multiple files asynchronously by blueimp jquery-fileupload

我怕爱的太早我们不能终老 提交于 2019-11-27 09:26:24
I'm using jQuery File Upload library ( http://github.com/blueimp/jQuery-File-Upload ), and I've been stuck figuring out how to use the library satisfying the following conditions. The page has multiple file input fields surrounded by a form tag. Users can attach multiple files to each input field All files are sent to a server when the button is clicked, not when files are attached to the input fields. Upload is done asynchronously Say the page has 3 input fields with their name attributes being "file1[]", "file2[]" and "file3[]", the request payload should be like {file1: [ array of files on

Restrict filetype ,size,single upload doesn't work in jquery file upload

拟墨画扇 提交于 2019-11-27 08:44:23
问题 I am trying to use the blueimp jquery file upload plugin with Spring MVC to upload the excel files.The files are getting uploaded. I would like to restrict the file type to excel(xls,xlxs),also allow only single file uploads . I am using the parameters as recommended by the plugin, also tried adding the add: callback to perform the validation neither of it works . Any help please . The js file I'm using(in the same order) jquery.min.js <!-- The jQuery UI widget factory, can be omitted if

Regular expression for excluding file types .exe and .js

帅比萌擦擦* 提交于 2019-11-27 06:01:10
问题 I am using JQuery File upload plugin, for giving value to the option accept files I need the regular expression which will tells what are the file types to be restricted. I need to restrict both exe and js which i achieved by using below expression (\.|\/)(!exe|!js)$ But this is expression was not allowing other files as well then I tried adding one extension as below (\.|\/)(!exe|!js|pdf)$ With Above regular expression it is accepting only pdf and not accepting exe and JS. Now I need to

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"