ajax - modify the contentType of a file input in a form with jQuery -


i have following html code of form submitting file server:

<form id="myform" action="upload_file.jsp" method="post" enctype="multipart/form-data"> <label for="desc">description:</label> <input type="text" name="desc" id\"desc"><br /> <label for="file">filename:</label> <input type="file" name="file" id="file"><br /> <input type="submit" name="submit" value="submit"> </form> 

when no file selected upload, have checked in google chrome content-type of file missing. in contrast, "application/octet-stream" when doing normal form submission html.

i wonder how can modify content-type value both cases consistent. thank much. :)

belle

i modify contenttype of file submit

as enctype="multipart/form-data" seperating file binary chunks no matter kind of file is, application/octet-stream attachment viewable in email, usenet, or web client,server side . mime attachment content type "application/octet-stream" means binary file. should content type of file in server side

 file.getcontenttype() 

Comments