Is it possible to upload an media(image & video ) directly to server without encoding which I am pick开发者_如何学Cing using UIImagepickerController, if so please suggest me how to do it.Please provide a sample for this.
In case of video upload you can send a file without encoding on the server Here is the code for that:
if ([type isEqualToString:(NSString *)kUTTypeVideo] || [type isEqualToString:(NSString *)kUTTypeMovie])
{
NSURL *urlvideo = [info objectForKey:UIImagePickerControllerMediaURL];
}
//IN urlVideo You get the path of media file(video files)
NSString *str = [NSString stringWithFormat:@"%@/uploadVideo.php",appUrl];
NSURL *url =[NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:self.gameID forKey:@"gameId"];//value for gameID Parameter
[request setFile:strurl forKey:@"uploadfile"]; //setFile method is used for upload video files
[request setRequestMethod:@"POST"];
[request setDelegate:self];
[request startSynchronous];
NSLog(@"responseStatusCode %i",[request responseStatusCode]);
NSLog(@"responseStatusCode %@",[request responseString]);
I hope this might help you but please remember this does not work in case of image upload
精彩评论