【发布时间】:2012-12-18 08:25:17
【问题描述】:
我遇到了一个奇怪的问题,我也看过其他解决方案,也看过ASIHTTPRequestgithub page。
我正在使用ASIHTTPRequest 库和ASIFormDataRequest 将图像上传到我的 Symfony 网络服务器。
我有两个问题:
1) 上传缓慢
我不确定它是什么,但用于上传图像数据大小 = 244671
的图像我假设大约 245 KB。
上传时间超过 15 秒。
我的 iPhone 在市区使用 Wifi 连接。
2) 服务器请求超时,即使成功
尽管数据已完全上传,但我收到服务器超时错误,图像正确显示在我的服务器上。
我使用的代码是:
// ------------------------------------------------------------------------------
// saving a compressed version of the file to disk to upload the file
// rather than using an uncompressed NSData which will take longer to upload
// ------------------------------------------------------------------------------
[imgData writeToFile:[MediaDirectory mediaPathForFileName:strFilename] atomically:YES];
[MediaDirectory addSkipBackupAttributeToFile:strFilename];
[request setFile:[MediaDirectory mediaPathForFileName:strFilename] withFileName:strFilename andContentType:@"image/png" forKey:@"file"];
我的图片不是什么巨大的图片,它只有 373 x 500 像素。
有什么想法吗?
如果有适当的解决方法,我不想禁用 ASIHTTPRequest 错误跟踪器中建议的缓冲区大小技巧。
【问题讨论】:
-
会不会是服务器端的问题?
-
不,我不这么认为,我在服务器上有另一个 Web 应用程序在 2 分钟内以 1440 x 900 的图像分辨率上传了 3 组 1.4MB 的文件而没有打嗝,上传单个 244KB 文件怎么会失败.
标签: ios symfony asihttprequest image-uploading asiformdatarequest