Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty type when uploading xls file #224

Open
MrHubble opened this issue Jul 20, 2015 · 3 comments
Open

empty type when uploading xls file #224

MrHubble opened this issue Jul 20, 2015 · 3 comments

Comments

@MrHubble
Copy link

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.

@murilloflores
Copy link

I'm facing the same issue right now. Have you found any solution other than changing your complete event?

@MrHubble
Copy link
Author

No, I'm still using the same workaround. Please report back if you find another solution.

@vishnur-github
Copy link

Any update on this guys ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants