Tag: file upload

iPhone上的HTML上传(iOS):文件名始终相同(image.jpg,image.png,…)

我正在使用非常简单的代码在我的响应式网站上传文件。 但是,当我使用iPhone上传图像时,图像名称始终是image.jpg ,与图像名称image.jpg 。 任何解决这个问题的解决方法? 为了debugging目的,我使用小代码创build了这个示例页面: <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { print "<pre>"; echo 'post object info:'; print_r($_FILES); print "</pre>"; } ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>File Upload Test for iphone</title> </head> <body> <form enctype="multipart/form-data" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="512000" /> <input name="userfile" type="file" /> <br /> <input type="submit" value="Send File" /> </form> […]

上传的video没有显示在藤蔓应用程序

我发现这个: https : //github.com/VineAPI/VineAPI/blob/master/endpoints.md 我有以下一些过程分享video藤应用程序。 1.login: https ://api.vineapp.com/users/authenticate使用上面的doc lin API成功validation。 我收到了一个密钥(会话密钥)。 为另一个进程。 之后,使用下一个Api上传video缩略图On藤。 2.thumnails https://media.vineapp.com/upload/thumbs/1.3.1.mp4.jpg 缩略图成功上传在藤上,收到服务器响应获取上传的缩略图URL在X上传密钥 。 你可以看到上图。 3.上传video : https : //media.vineapp.com/upload/videos/1.3.1.mp4 video数据成功上传在藤上,收到服务器响应获取上传的videourl在X上传密钥 。 你可以看到上图。 4.创buildpost: https ://api.vineapp.com/posts 发布成功创build并收到服务器响应 { code = ""; data = { created = "2016-04-18T09:27:20.000000"; permalinkUrl = "https://vine.co/v/iFaqLt7w5Qm"; postId = 1333777877887795200; videoUrl = "http://v.cdn.vine.co/static/private_post_old_client.mp4"; }; error = ""; success = […]

使用AFNetworking在iOS上上传大文件 – 错误请求超时

我面临着下一个问题。 在我的项目中,我正在使用AFNetworking进行所有networking操作。 其中之一是上传video的服务器。 然后我试图上传大型video(大约100 Mb),我得到请求超时错误。 错误域= NSURLErrorDomain代码= -1001“请求超时。” 的UserInfo = 0x15641b30 {NSErrorFailingURLStringKey = http://server.name/path,NSErrorFailingURLKey = http://server.name/path,NSLocalizedDescription =请求超时,NSUnderlyingError = 0x16f7a000“请求超时。”} 现在我正在使用AFNetworking v1.3.3,而且我不能使用v2.0,因为需要iOS5支持。 当上传刚刚开始,上传进度看起来很好(我通过UploadProgressBlock看到它)。 但是在几兆字节之后,上传开始变慢,然后停止。 SpeedTest给我上传5Mbps,下载5Mbps。 通过networking浏览器上传video工作正常,所以我不认为这是服务器问题。 这是我的代码: AFHTTPClient *client = [AFHTTPClient clientWithBaseURL: [NSURL URLWithString:@"http://server.name/"]]; NSString *appid = [[self class] sharedProvider].ApplicationId; ALAssetRepresentation *representaion = [videoData.videoAsset defaultRepresentation]; NSURL *url = [BRDataProvider getVideoAssetURLForTempFileWithAsset: videoData.videoAsset]; AFHTTPRequestOperation *operation; if (url) { […]

使用AFNetworking和PHP从照片库上传选定的图像

我正尝试使用AFNetworking上传一张从照片库中select的图像,但我有点困惑。 一些代码示例正在使用图像数据直接上传,一些正在使用文件path。 我想在这里使用AFNetworking示例代码: NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; NSURL *URL = [NSURL URLWithString:@"http://example.com/upload"]; NSURLRequest *request = [NSURLRequest requestWithURL:URL]; NSURL *filePath = [NSURL fileURLWithPath:@"file://path/to/image.png"]; NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithRequest:request fromFile:filePath progress:nil completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { if (error) { NSLog(@"Error: %@", error); } else { NSLog(@"Success: %@ %@", […]

在iOS中发送audio文件和JSONstring

我试图发送一个audio文件和一个JSONstring到PHP服务器。 用下面的代码将发送JSON,但文件到达空。 如果我把JSON块放在audio块下面,文件完全到达,但是JSON是空的。 有什么想法吗? – (void)sendFile:(NSString *)filePath URL:(NSString *)urlString JSON:(NSData *)jsonBody { NSString *jsonString = [[NSString alloc] initWithData:jsonBody encoding:NSUTF8StringEncoding]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"]; if ([defaults objectForKey:@"UserToken"]) { // add the header to the request. [request addValue:[defaults objectForKey:@"UserToken"] forHTTPHeaderField:@"token"]; } NSString *boundary = [NSString stringWithString:@"—————————14737809831466499882746641449"]; NSString *contentType = [NSString […]

iOS通过wifi上传文件到应用程序

我正在开发一个应用程序,需要通过本地的WiFinetworking,如好读应用程序支持传输文件。 这个想法是,iPhone应用程序创build一个HTTP服务器可以通过Web浏览器显示表单上传文件到应用程序。 在我的应用程序中按无线传输选项 访问一个IP地址,如:192.168.0.12:port 使用该页面将file upload到我的应用程序 任何想法? 谢谢

无法将图像上传到服务器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"; […]

针对iOS SDK v2的Amazon S3video上传问题

亲爱的开发者,我有与亚马逊S3video上传相关的问题。 我正在使用iOS SDK V2来安排iOS Client和Amazon之间的交互。 我已经阅读了所有文档,并调查了由Amazon开发人员提供的手册,并且发生了一些没有logging的问题。 我将从一开始就开始解释问题。 1) 身份validation,我使用STS方法来validation用户的亚马逊S3请求。 这个步骤并不是因为我使用这个authenticationconfiguration来上传图片,而且一切都很完美。 2) 对于我正在使用的video文件的上传: AWSS3TransferManager 上传的示例代码: AWSS3PutObjectRequest *logFile = [AWSS3PutObjectRequest new]; logFile.bucket = uploadTokenData_.bucket; logFile.key = key; logFile.contentType = contentType; logFile.body = data_; logFile.contentLength = [NSNumber numberWithInteger:[data_ length]]; AWSS3 *S3 = [[AWSS3 alloc] initWithConfiguration:[AWSCredentialsProvider runServiceWithStsCredential]]; AWSS3TransferManager *transferManager = [[AWSS3TransferManager alloc] initWithS3:S3]; [[transferManager.s3 putObject:logFile] continueWithBlock:^id(BFTask *task) { NSLog(@"Error […]

移动Safari浏览器图片上传及其大小

好吧,很多人知道,Safari浏览器手机现在允许通过相机或图像库file upload。 问题在于,当照相机拍摄照片时,照片会被照原样发送,这意味着它在内存上非常沉重(即使在iPhone 4上,我认为它也是2或3 MB左右)。 这使得上传真的很慢,带宽消耗(不适合移动)。 你知道用<file /> html标签是否有办法对iOS说:“嘿,你还可以压缩图片吗?” – 就像通过邮件应用程序发送图片时一样。 提前致谢。

如何从函数写入.csv文件?

嘿朋友,我通过使用这个function得到了我的iphone的所有联系细节.. -(void)collectContacts { ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook); //NSLog(@" the Name %@%",people); for(int i = 0;i<ABAddressBookGetPersonCount(addressBook);i++) { ABRecordRef ref = CFArrayGetValueAtIndex(people, i); // Get First name, Last name, Prefix, Suffix, Job title NSString *firstName = (NSString *)ABRecordCopyValue(ref,kABPersonFirstNameProperty); NSString *lastName = (NSString *)ABRecordCopyValue(ref,kABPersonLastNameProperty); NSString *prefix = (NSString *)ABRecordCopyValue(ref,kABPersonPrefixProperty); NSString *suffix = (NSString *)ABRecordCopyValue(ref,kABPersonSuffixProperty); […]