MKNetworkKit icon indicating copy to clipboard operation
MKNetworkKit copied to clipboard

Upload from a stream

Open yas375 opened this issue 12 years ago • 3 comments

When I've tried to use setUploadStream: I got error "request body stream exhausted". After some researching I've found some topics on apple's dev forums where was said that method -connection: needNewBodyStream: must be implemented. Here are some related dissuasions with answers from apple's engineers: https://devforums.apple.com/message/255325#255325 https://devforums.apple.com/message/237388

Also I found that we have to set "Expect: 100-Continue" header. Here is also related answer from apple's engineer: https://devforums.apple.com/message/344093#344093

I'm not 100% sure about this code and need somebody else for comments and advices. I don't use anymore upload via stream in my project( But will be glad to help to do it possible with MKNetworkKit.

Also searching for needNewBodyStream during all time on apple's dev forum may give you some other interesting discussions: https://devforums.apple.com/search.jspa?q=needNewBodyStream&resultTypes=MESSAGE&peopleEnabled=true&communityID=&dateRange=all&username=

yas375 avatar Jan 07 '13 16:01 yas375

@MugunthKumar how about adding a request for accepting upload via a stream onto your test server?

I've added something like below on my test server for testing:

$postdata = file_get_contents("php://input");
file_put_contents('/home/hosting_yas/projects/****/htdocs/uploaded/' . date('r') . '.jpg', $postdata);

Than I can add a new button "Upload as a stream" into test app and it will allow us to test it. Unfortunately there is no way to test it with OHHTTPStubs(

yas375 avatar Jan 07 '13 16:01 yas375

Can you email this file to me?

MKSG-MugunthKumar avatar Jan 11 '13 11:01 MKSG-MugunthKumar

done

yas375 avatar Jan 11 '13 22:01 yas375