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

Error: Unexpected end of multipart data #88

Open
anilpai opened this issue Jun 25, 2016 · 2 comments
Open

Error: Unexpected end of multipart data #88

anilpai opened this issue Jun 25, 2016 · 2 comments

Comments

@anilpai
Copy link

anilpai commented Jun 25, 2016

I am trying to use unirest put method to upload a file from form data.

Error: Unexpected end of multipart data
    at /Users/anilpai/Desktop/file-uploader/node_modules/dicer/lib/Dicer.js:62:28
    at _combinedTickCallback (node.js:370:9)
    at process._tickCallback (node.js:401:11)
@nijikokun
Copy link
Contributor

I have been unable to replicate the issue.

@anilpai
Copy link
Author

anilpai commented Jul 8, 2016

var readStream = fs.createReadStream(serverFile);
var endpoint = util.format(config.putFileUploadEndPoint, self.bucket, localFile.replace(/ /g, '+'));
var total = fs.statSync(serverFile).size;

readStream.pipe(
  unirest.put(endpoint)
       .headers({
         'Accept': 'application/json',
         'Content-Type': 'application/octet-stream',
         'Authorization':('Bearer ' + self.accessToken),
         'Content-Length': total
       })
       .end(function(response) {
          if (response.statusCode != 200) {
             return callback(response.statusCode)
           } else {
             return callback(null, response.body);
         }
       }
    )

Additional Link of similar issue : https://jira.appcelerator.org/browse/API-1185

Also tried adding readStream.unpipe() and still doesn't solve the issue...

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

2 participants