How we Can post Video and Image in ASIHTTPRequest ?
Posted
by
GhostRider
on Stack Overflow
See other posts from Stack Overflow
or by GhostRider
Published on 2011-01-03T05:53:44Z
Indexed on
2011/01/03
9:53 UTC
Read the original article
Hit count: 277
I want to post one image to my webservice and one video too , but problem is that when it go to video part it give me Excess-bad Error
NSString *url = [NSString stringWithFormat:@"http://example.com/add_videoxml.php"];
networkQueue = [[ASINetworkQueue alloc] init];
[networkQueue cancelAllOperations];
[networkQueue setShowAccurateProgress:YES];
//[networkQueue setUploadProgressDelegate:progressBar];
[networkQueue setDelegate:self];
[networkQueue setRequestDidFinishSelector:@selector(requestFinished:)];
[networkQueue setRequestDidFailSelector: @selector(requestFailed:)];
request= [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:url]] ;
[request setPostValue:@"284" forKey:@"id"];
[request setPostValue:@"show" forKey:@"show"];
[request addRequestHeader:@"Content-Type"
value:@"multipart/form-data;boundary=---------------------------1842378953296356978857151853"];
NSData *imgData=UIImageJPEGRepresentation(userImage, 0.9);
if(imgData != nil){
[request setFile:imgData withFileName:@"Loveatnight" andContentType:@"image/jpeg" forKey:@"image"];
}
//[request addRequestHeader:@"Content-Type"
// value:@"multipart/form-data;boundary=---------------------------1842378953296356978857151853"];
if(videoData != nil){
[request setFile:videoData withFileName:@"Loveishard" andContentType:@"image/jpeg" forKey:@"uploadfile"];
}// error is come on that line
[request setTimeOutSeconds:500];
//NSLog(@"%@",request);
[networkQueue addOperation:request];
[networkQueue go];
Added by the OP
[request setFile:videoData withFileName:@"Loveishard"
andContentType:@"video/quicktime"
forKey:@"uploadfile"];
i use this becuase my video formate is mov , but it again give error
© Stack Overflow or respective owner