iphone - Unable to upload video longer than 1 minute -
i working on application require video upload functionality. using nsurlrequest , working fine video less 1 minute in length, cause problem when video large. 1 have idea that???
nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request seturl:[nsurl urlwithstring:urlstring]]; [request setcachepolicy:nsurlrequestuseprotocolcachepolicy]; [request sethttpmethod:@"post"]; nsstring *boundary = @"----f00"; nsstring *contenttype = [nsstring stringwithformat:@"multipart/form-data; boundary=%@",boundary]; [request addvalue:contenttype forhttpheaderfield:@"content-type"]; filedata = [nsdata datawithcontentsofurl:[mediadict objectforkey:uiimagepickercontrollermediaurl]]; [body appenddata:[[nsstring stringwithformat:@"\r\n--%@\r\n", boundary] datausingencoding:nsutf8stringencoding]]; [body appenddata:[[nsstring stringwithformat:@"content-disposition: form-data; name=\"data[file_name]\"; filename=\"%@\"\r\n", filename] datausingencoding:nsutf8stringencoding]]; [body appenddata:[[nsstring stringwithformat: @"content-type: %@\r\n\r\n",filecontenttype] datausingencoding:nsutf8stringencoding]]; [body appenddata:filedata]; [request sethttpbody:body]; nsurlconnection *theconnection=[[nsurlconnection alloc] initwithrequest:request delegate:self]; if (theconnection) { // create nsmutabledata hold received data. // receiveddata instance variable declared elsewhere. self.receiveddata = [nsmutabledata data]; } else { // inform user connection failed. uialertview *didfailwitherrormessage = [[uialertview alloc] initwithtitle: @"nsurlconnection " message: @"didfailwitherror" delegate: self cancelbuttontitle: @"ok" otherbuttontitles: nil]; [didfailwitherrormessage show]; [spinnerview removefromsuperview]; }
i appreciate friends.
set timeout interval , check whether working or not
nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request seturl:[nsurl urlwithstring:urlstring]]; [request setcachepolicy:nsurlrequestuseprotocolcachepolicy]; [request sethttpmethod:@"post"]; [request settimeoutinterval:6000];
Comments
Post a Comment