Tag: 图像上传

图片上传到Facebook,但没有显示在页面上

我试图通过graphicsAPI调用从iPad应用程序上传到Facebook页面上的特定相册的图像。 一切工作正常,来自Facebook的回应返回成功与post的身份证,但我只是看不到在页面上传的图像。 我正在使用Appcelerator Titanium来做这个。 以下是我的代码: var fb = require('facebook'); fb.appid = 'MY APP ID'; fb.permissions = ['read_stream']; function postImageToFb(){ fb.reauthorize(['publish_actions','manage_pages'], 'me', function(e){ if (e.success) { // If successful, proceed with a publish call var data = { source: Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory+'/image.png').read(), message: 'Hello pic' } fb.requestWithGraphPath('<album-id>/photos',data,'POST',function(e){ alert('Post to fb: '+JSON.stringify(e)); if(e.success){ alert('Photo submitted successfully to fb.') }else{ […]

将IOS映像上传到.net服务

我正在上传图片(jpg)到.net服务。 如果我上传小图片,上传效果很好,但是当我发送“大”图片(大于1 MB或“大”)图片上传成功时,图片看起来像这样 我通过curltesting了Web服务,它工作正常。 任何想法? 谢谢!!!!!! 我的上传代码是: -(void)uploadJPEGImage:(NSString*)requestURL image:(UIImage*)image pictureName: (NSString*)pictureName { NSURL *url = [[NSURL alloc] initWithString:requestURL]; NSMutableURLRequest *urequest = [NSMutableURLRequest requestWithURL:url]; [urequest setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; [urequest setHTTPShouldHandleCookies:NO]; [urequest setTimeoutInterval:600]; NSData *postImageData = UIImageJPEGRepresentation(image, 0.9 ); NSMutableData *body = [NSMutableData data]; [urequest setHTTPMethod:@"POST"]; //STEP2 Creating Boundary // There are no rules as of the content of […]

使用Alamofire参数数组上传多个文件

我有一组参数和图像数组,每一组参数都包含一个且只有一个image.my代码 let imgData = UIImageJPEGRepresentation(imageView.image!, 0.2)! Alamofire.upload(multipartFormData: { multipartFormData in multipartFormData.append(imgData, withName: "fileset",fileName: "file.jpg", mimeType: "image/jpg") for (key, value) in params { multipartFormData.append(value.data(using: String.Encoding.utf8)!, withName: key) } }, to:URLUpdateProfile, method:.post, headers:headers) { (result) in switch result { case .success(let upload, _, _): upload.uploadProgress(closure: { (progress) in print("Upload Progress: \(progress.fractionCompleted)") }) upload.responseJSON { response in print(response.result.value) […]

如何在base64中上传图像的多部分数据使用networking

我已经使用了下面的代码,但我得到的响应是java.lang.NullPointerException & INTERNAL_SERVER_ERROR我尝试了很多不同的方法,但无法修复它,请帮助解决这个问题。 从图像select器获取图像 UIImage *chosenImage = info[UIImagePickerControllerEditedImage]; Profilebackground.image = chosenImage; [picker dismissViewControllerAnimated:YES completion:NULL]; NSURL *resourceURL; UIImage *image =[[UIImage alloc] init]; image =[info objectForKey:@"UIImagePickerControllerOriginalImage"]; NSURL *imagePath = [info objectForKey:@"UIImagePickerControllerReferenceURL"]; imageName = [imagePath lastPathComponent]; resourceURL = [info objectForKey:UIImagePickerControllerReferenceURL]; NSString *extensionOFImage =[imageName substringFromIndex:[imageName rangeOfString:@"."].location+1 ]; if ([extensionOFImage isEqualToString:@"JPG"]) { imageData =UIImageJPEGRepresentation(image, 1.0); base64 = [imageData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; extension=@"image/jpeg"; […]

无法将图像上传到服务器ios

您好,我正尝试从我的IOS设备上传图片到服务器。 这里是我的代码上传图像 – (IBAction)btnUpload:(id)sender { if (self.imageViewGallery.image == nil) { UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Wait" message:@"Please Select An Image To Upload." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [ErrorAlert show]; NSLog(@"error"); } else{ NSData *imageData = UIImageJPEGRepresentation(self.imageViewGallery.image, 90); NSString *urlString = @"http://localhost/ColorPicker/api.upload.php"; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"]; NSString *boundary = @"—————————14737809831466499882746641449"; […]

Alamofire分段上传后错误在Swift中

当我试图上传图像使用Alamofire我得到.POST错误 我附上一个图像与此一起显示错误 ( http://www.awesomescreenshot.com/image/422237/0d5fe4a4b486b14fdf52f8ca26d22bea )

Apple文档中提供的SimpleFTPSample中存在打开stream错误

我想通过ftp上传图片到服务器。 我在苹果文档中find一个SimpleFTPSample ,并将其下载。 当运行应用程序(我使用xcode 4.5.2,目标iphone 5.0模拟器),它工作正常。 我试图通过这个应用程序在我的服务器中创build目录,并成功。 但是,上传应用程序中提供的图像将导致“打开stream错误”。 我没有做任何改变的应用程序。 只需inputurl,用户名和密码。 我认为这是没有问题的,因为我指定的目录是成功创build的。 当创build目录的URL是“ftp://54.xyz/newfolder/”它被成功创build。 但是,上传的url是“ftp://54.xyz/TestImage1.png” 文件path是“/var/folders/pn/8p0jc4qn70v37j58c1kwf8l80000gn/T/TestImage1.png” 通过追加最后的组件string与我指定的FTPurl获得URL。 那么,它有什么错误? 在fn中, – (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode { case NSStreamEventErrorOccurred: { [self stopSendWithStatus:@"Stream open error"]; } break; 被调用并显示stream打开错误。 我GOOGLE了一整天,没有需要的结果。 它非常紧急,我甚至不能为此开始赏金。 请帮忙

如何通过照片框架快速循环照片库

我有一个应用程序为我的应用程序上的每张票创build一个独特的照片库。 我需要弄清楚如何在图库中循环,这样我就可以一次将图像上传到服务器。 我在YouTube上跟随了这些教程。 ( video )我目前使用Swift作为我的语言。 我的最终目标将是像下面的伪代码。 //I need the following for loop example for photo in gallery { uploadToServer(photo) } //this function works already func uploadToServer(photo:UIImage) { callRest postPhoto } 这里是我的代码到目前为止无法弄清楚如何循环。 他们虽然。 let fetchOptions = PHFetchOptions() fetchOptions.predicate = NSPredicate(format: "title = %@", self.albumName)? let collection:PHFetchResult = PHAssetCollection.fetchAssetCollectionsWithType(.Album, subtype: .Any, options: fetchOptions) if let first_Obj:AnyObject […]

使用SOAP将使用WCF服务的图像从iPhone上传到服务器

hiii,我使用wcf SOAP服务为我的应用程序,我发送下面的请求。 postStr = [NSString stringWithFormat:@"<?xml version=\"1.0\"?>\n" "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" "<s:Body>\n" "<InsUpdDelActivityInfo xmlns=\"http://tempuri.org/\">\n" "<objEventsContent xmlns:d4p1=\"http://schemas.datacontract.org/2004/07/iCampuslite.Model.ActivityStream\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\n" "<d4p1:ActCommentId i:nil=\"true\" />\n" "<d4p1:ActSubTypeCd i:nil=\"true\" />\n" "<d4p1:ActType>Status</d4p1:ActType>\n" "<d4p1:ActTypeCd>1</d4p1:ActTypeCd>\n" "<d4p1:ActivityAnswersList />\n" "<d4p1:ActivityComments />\n" "<d4p1:ActivityId i:nil=\"true\" />\n" "<d4p1:ActivityLike />\n" "<d4p1:ActivityName>%@</d4p1:ActivityName>\n" "<d4p1:ActivityStreamImagesBytes>%@</d4p1:ActivityStreamImagesBytes>\n" "<d4p1:AnswerDesc i:nil=\"true\" />\n" "<d4p1:AnswerId>0</d4p1:AnswerId>\n" "<d4p1:CommentDesc i:nil=\"true\" />\n" "<d4p1:CommentId i:nil=\"true\" />\n" "<d4p1:CreatedUserId>%@</d4p1:CreatedUserId>\n" "<d4p1:CreatedUserName i:nil=\"true\" />\n" "<d4p1:FileOrLinkName i:nil=\"true\" />\n" "<d4p1:IsLiked>0</d4p1:IsLiked>\n" "<d4p1:IsTotalSchool i:nil=\"true\" />\n" […]

上传IOS应用程序的图像到服务器文件大小太大

我正在上传照片到一个IOS应用程序的服务器。 重要的是照片上传质量没有损失,并上传JPEG格式。 我目前的问题是,照片​​上传没有质量损失,但有一个比预期的文件大小。 例如:我通过应用程序上传了一个文件,文件大小为4.7 MB。 当我通过电子邮件发送相同的照片给我自己,并select电子邮件的“实际照片”选项,照片的大小只有1.7 MB。 并排比较显示质量没有差异。 这是我如何上传文件。 ALAssetsLibrary *library = [ALAssetsLibrary new]; [library getImageAtURL:orderImage.imageUrl with completionBlock:^(UIImage *image) NSData *fileData = UIImageJPEGRepresentation(image, 1.0) NSURLRequest *request = [self multipartFormRequestWithMethod:@"POST" path:path parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { [formData appendPartWithFileData:fileData name:@"uploadedfile" fileName:fileName mimeType:mimeType]; [formData appendPartWithFormData:[extraInfo dataUsingEncoding:NSISOLatin2StringEncoding] name:@"extraInfo"]; }];