Tag: 图片上传

AFNetworking 3.0用于上传图像错误的多部分表单数据

我一直在尝试使用multipart表单数据networking3.0将图像上传到我的AWS服务器,但显然,我试图上传的每个图像都以失败模块结束。 代码写在objective-c中。 – (NSURLSessionUploadTask *)uploadImageTask:(NSMutableDictionary *)dictionary { NSString *s3BucketUrl = [dictionary objectForKey:@"s3BucketUrl"]; NSData *imageData = [dictionary objectForKey:@"imageData"]; NSString *contentType = [dictionary objectForKey:@"contentType"]; NSString *filename = [dictionary objectForKey:@"filename"]; NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:s3BucketUrl parameters:dictionary constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { [formData appendPartWithFileData:imageData name:@"file" fileName:filename mimeType:contentType]; } error:nil]; AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; NSURLSessionUploadTask *uploadTask = […]

将图像从iPhone上传到.net ashx处理程序

我正在使用接收图像的ashx脚本将图像从iPhone上传到我的服务器。 我遇到的问题是,无论我已经尝试context.Request.Files是空的。 这是我的xcode代码 NSData *imageData = [[appDelegate currentProjectData] objectForKey:@"frontImage"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.****.com/iPhoneJpgUploadHandler.ashx"]]; [request setHTTPMethod:@"POST"]; NSString *boundary = @"- – – – – – – – – – Boundary String – – – – – – – – – -"; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary]; [request addValue:contentType forHTTPHeaderField:@"Content-Type"]; NSMutableData *body = […]

如何在iOS中发布更多的图片上传代码参数?

您好我正在上传图像的PHP服务器,并成功上传与此代码的帮助 – (NSString*)uploadData:(NSData *)data toURL:(NSString *)urlStr:(NSString *)_userID { // File upload code adapted from http://www.cocoadev.com/index.pl?HTTPFileUpload // and http://www.cocoadev.com/index.pl?HTTPFileUploadSample NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:urlStr]]; [request setHTTPMethod:@"POST"]; // NSString* = [NSString stringWithString:@"0xKhTmLbOuNdArY"]; NSString *stringBoundary = [NSString stringWithString:@"—————————14737809831466499882746641449"]; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",stringBoundary]; [request addValue:contentType forHTTPHeaderField: @"Content-Type"]; NSMutableData *body = [NSMutableData data]; […]