-
-
Notifications
You must be signed in to change notification settings - Fork 8k
maxFileSize and acceptFileTypes not working #760
Comments
I guess you are using the basic plugin version. |
So no chance of using maxFileSize and acceptFileTypes on the basic plugin version??? |
You can incorporate the _validate() and _hasError methods of the UI version into the basic plugin, if you desire to do so: |
Glad I found this. I was banging my head on this all day. Your plugin is excellent. I was just puzzled that these options aren't included in the non-ui version since these limitations have nothing to do with UI. Thanks in any case. Your plugin rocks. |
This Stack Overflow posts explains how to add support: http://stackoverflow.com/questions/17451629/maxfilesize-and-acceptfiletypes-in-blueimp-file-upload-plugin-do-not-work-why |
That blueimp guy since moved the validation code out into it's own plugin, which you can simply include after the process and basic plugin and you will have validation support out of the box: |
HI blueimp,
Also could submitting on add somehow ignore validation?
Thanks, |
Yeah, if you override the add callback, you won't have validation by default. |
So @blueimp you say the validations (and image resize it seems) won't work by default if the add callback is overridden. Any suggestion on how to make these features work while keeping the custom add callback ? I looked all over the internet but found nothing! |
Please have a look here:
Alternatively, you can also simply start the processing in your own callback, like this: |
I couldn't get the first option to work but the second one worked like a charm! Thanks for your awesome support! |
@blueimp, I am using the basic implementation. I added both: https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.fileupload-process.js I then added this to my config:
This appears to work, as the automatic upload is not firing as expected. My problem is I am unable to find the callback for failed validation so I can write my own logic for displaying the error. Thoughts? |
Hi, I am not using the add call back and I am trying to achieve file types restriction by using the accept file types option. I need to restrict exe and js files to be added for that I am using the below regular expression acceptFileTypes: /^[^.]+$|.(?!(js|exe)$)([^.]+$)/ig The issue I am facing now is that when i add more than one exe file the validation is not showing error for the 2nd exe file in the same way when I am adding 3 exe files then validation is happening for 2 exe files but the 3rd file is not showing validation error. This is same for js as well. Couldnt able to figure out if its because of the regular expression or its because of any other issue. Could any one please let me know why it is happening like this. Thanks, |
@rreynier, there doesn't seem to be a validation callback. Instead I am using the following code to manually invoke the process queue (which has validation as the only item). The process function returns a promise. You can attach a failure handler to this promise to invoke custom logic for displaying the error.
|
Thank @amithgeorge It works very well! |
Hi there.
The properties maxFileSize and acceptFileTypes aren't working.
Here's my code:
Both properties dont work because allow me select any kind of file and allows any file size... :(
Thank for your help!
The text was updated successfully, but these errors were encountered: