I want to send the post data from an input like this:
<input type="file" name="userFile" id="userFile"/>
?
I need to send it via ajax using $.post to a specified file.
How can I do this?
I want to send the post data from an input like this:
<input type="file" name="userFile" id="userFile"/>
?
I need to send it via ajax using $.post to a specified file.
How can I do this?
Without HTML5, this isnt possible, and the html5 solution won't work in all browsers without workarounds for browsers that don't support it.
The most cross-browser way to solve this is to not use ajax and to instead post to a hidden iframe.
Or use a plugin such as uploadify.
Most if not all of the jQuery plugins that implement this use either flash or hidden iframes when the html5 method isn't supported.