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.
精彩评论