here is the situation:
- my server only accept multipart/form-data upload action.
- my app need to implement background upload.
I've tried below:
if I ignore
background, I can useuploadTaskWithRequest:fromData:, build all boundary, content-disposition, and file data, then upload to a supported server. and I do successfully have done this.BUTI need to use background transfer.if I force this method in background mode, I got an error:
Upload tasks from NSData are not supported in background sessions.if I use background mode, and use
uploadTaskWithRequest:fromFile:, I got something like 'stream ended unexpectedly' from the server, as this question mentions, the best answer suggest people to usefromDatawhich apparently is not my need.
so is there any way to accomplish this? since the server can't change it's support, I NEED background transportation and multipart/form-data content-type both.
curlornc?fromDatamethod, which I generate all multi-part data by code. and usefromFilemethod, you don't need to generate data, so why should I test thisdataor how could I test thedata. and I logged the request , thefromFilemethod even didn't send any body-data, body-stream and content-length, so, why does this method exists...or should build some other things by code? where is the doc or demo?...curl. Sorry for confusion.