Non-ajax upload with multiple uploads and restrictions for filesize and filetypes
I'm used to using a standard form with JavaScript validation, custom captcha... etc. Now I would like to enrich my form with an upload function.
The standard HTML upload functionality doesn't cut it, since I would like:
- support for multiple file uploads
- client-side restrictions for filesize (and feedback if not valid)
- client-side restrictions for certain filetypes (and feedback if not valid)
(It goes without saying that these things would anyway be checked server-side aswell).
Solutions like Uploadify, SWFUpload, Plupload have the functionality that I need, but they will force me to change my setup. From what I've gathered, there are two ways of working:
- Using Uploadify, I could use scriptData to send the values of my form asynchronously to the script that also processes the files. Client-side form validation would work, but开发者_开发技巧 it would cause problems with my custom captcha.
- Using Uploadify, I could also submit the form on completion of the uploads, but that would completely defeat the purpose of the captcha. This would imply that one could upload files, even with a wrong captcha, cluttering the server.
What I'm asking is this:
Is there a way to implement the functionality of Uploadify (or similar) so that it would work just like a traditional
input type="file"
field on submit of the form?
Maybe I'm thinking too simplistic, but in my view it would be more practical. It would also degrade gracefully on clients without JavaScript / Flash, without extra workarounds.
I've found out that Plupload does that almost exactly:
Plupload Upload + Synchronous form question
精彩评论