Chrome returning null content type on file upload
December 6, 2010
Posted by on
Chrome (up to at least 8.0.552.215) has issues with content types of files. For me it was if the file did not have an extension.
See here for the old (unfixed issue) and here for the new issue.
Note: I’m using struts 2.0.14 with the FileUploadInterceptor (uses ServletFileUpload and JakataMultipartRequest) and if I upload a file without an extension then struts throws a null pointer exception. If I take the same file and add any extension (e.g. .bin) then it will upload correctly.
Looking at the code for struts 2.2.1 or the current trunk (line 275) it still looks like this is a problem.
Firefox defaults to “application/octet-stream” which, in this case, works.
Anyone else had this issue or has a workaround? Maybe allow the setting of a default content type in the FileUploadInterceptor?
Update: This appears to be fixed in the code base – waiting for word on when it will get into a release.