5
votes

Im using this code for uploading images: https://github.com/NativeScript/sample-ImageUpload

When i upload an image i got success notification. I'm trying to read response from server and also checked task's complete event:

task.on("complete", logEvent);

function logEvent(e) {
    console.log(JSON.stringify(e));        
}

and this is the output:

{"eventName":"complete","object":{"_observers":{"complete":[{}],"propertyChange":[{}]},"_session":{"_id":"image-upload"},"_id":"image-upload{1}","_description":"{ 'uploading': Test0.png }","_upload":3807297,"_totalUpload":3807297,"_status":"complete"},"response":{}}

as you can see response is null. So how can i read the response from server?

1
Is it multipart upload? - Dlucidone
@Dlucidone yes it is. - Ali Dehqan
Is it for iOS multipart upload? - Dlucidone
@Dlucidone No, it's for android - Ali Dehqan
This is happening for me in case of iOS and sent a pull request for that.the issue you are facing is with the file name being sent to upload or the path issue. - Dlucidone

1 Answers

-1
votes

the data told you why is null ? it is not finish to upload is only in session. look here at the send image function , what are youy need to do.