empty type when uploading xls file
When I attempt to upload a xls file the file is uploaded correctly (I have checked on S3 and it's there) but it returns with an empty ("") filetype whereas the other uploads (xlxs, pdf, jpg, etc) return with a filetype value.
I have tried adding custom code but it doesn't change the value of data:
#s3_direct_upload.js.coffee
setUploadForm = ->
$uploadForm.find("input[type='file']").fileupload
add: (e, data) ->
file = data.files[0]
file.unique_id = Math.random().toString(36).substr(2,16)
fileType = ""
if ("type" of file) && (file.type != "")
fileType = file.type
else
ext = file.name.split('.').pop()
if ext == "xls"
fileType = "application/vnd.ms-excel"
data.files[0].type = fileType
I've added similar code as above to formData which results in the correct name: "content-type" being sent to S3 but an empty type is still returned in my s3_uploads_complete event. As a workaround (in my complete event) I use similar code as above to set the correct type in my hidden form value so the correct values are submitted with the form.
My workaround is working for me at the moment but it would be great if someone could shed some light as to where I might be going wrong.
I'm facing the same issue right now. Have you found any solution other than changing your complete event?
No, I'm still using the same workaround. Please report back if you find another solution.
Any update on this guys ?