开发者

iPhone + file upload control

开发者 https://www.devze.com 2022-12-11 20:08 出处:网络
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 u

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

精彩评论

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