Why does NSURLSession uploadTaskWithRequest:fromData: fail to upload to php server?

巧了我就是萌 提交于 2019-12-04 12:47:55

It wasn't missing a colon, it was missing a semi-colon.

"name=\"userfile\" : filename=\"%@\"\r\n""

Should be

"name=\"userfile\"; filename=\"%@\"\r\n""

At least this is the only way your code worked for me (thanks by the way!).

I had an issue with a semi-colon here->

"name=\"userfile\" ; filename=\"%@\"\r\n"" 

So it was a malformed body basically.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!