开发者

iPhone + file upload control

I have an application which uploads file from iPhone to web server.

Problem is that I want to give users a control like from which they can select the file / photo from the device and which is than uploaded on server开发者_运维问答.

Can anyone help me


You can get the UIImage content as a JPEG or PNG wrapped in NSData:

NSData *data = UIImageJPEGRepresentation(image, 1);
if( data ) {  // it's possible nil may be returned
    ;// do stuff here. 
    // see: link to other answer on SO below.
    // if you want to write to file, try:
    [data writeToFile:filePath atomically:YES];
}

File Upload to HTTP server in iphone programming


I think you want to use an ImagePickerController that is the system component to allow a user to choose a photo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜