I've added file upload support to the form plugin and I could use some
help testing it out.  If this feature interests you then go ahead and
grab the beta plugin at:

http://malsup.com/jquery/form/file/jquery.form.js

File upload support is baked right into the plugin and there are no
external dependencies.  The plugin will automatically detect file
input elements and use an iframe to submit the form if there are files
to be uploaded.  No extra coding or metadata is needed to take
advantage of this new feature.  In addition, even though an iframe is
used instead of the XHR object, callbacks and global triggers still
work as expected (so any code that you have in place to display
activity indicators or blocking elements will still work).

However, there are some challenges when using iframes in this manner.
For one, it is quite difficult to determine if the submit operation
succeeded or failed.  The iframe becomes the target of the submit
operation and so that is where the server response is written.  The
form plugin does its best to determine the data type (html, xml, etc),
but the status is always 'success' unless an exception is caught
during the type determination.  (Note that dojo and YUI haven't
figured out how to solve the status problem either.)

I've prepared a sample page with several forms here:

http://malsup.com/jquery/form/file/

If you use this page for testing *please* be kind to my server and
only upload small files! I'd really prefer that you download the
plugin and integrate it into your own test environment if possible.

I've done some testing on FF, IE and Opera and the results are
encouraging.  I don't have access to Safari so I'm sure there are
issues lurking for that platform.

If you're interested in the code you can find it all tucked into the
end of the ajaxSubmit method in a function called "fileUpload".

Mike

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to