我使用下面的代码(与ASIHTTPRequest)尝试从我的iPhone上传php文件到我的Macbook Pro上运行的LAN MAMP服务器。我的目标-C和我的PHP似乎排队,但文件不上传。ASIHTTPRequest文件上传和PHP
Objective-C代码
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
[path stringByAppendingPathComponent:[pieces objectAtIndex:indexPath.row]];
NSURL *url = [NSURL URLWithString:@"http://192.168.1.102:8888/upload.php"];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
[request setFile:path forKey:@"file"];
PHP代码
<?php
$target = "uploads/";
$target = $target . basename($_FILES['file']['name']) ;
$ok=1;
(move_uploaded_file($_FILES['file']['tmp_name'], $target));
?>
这是怎么回事错在这里?
感谢,
詹姆斯
对不起,我没有上传PHP文件,我正在上传CSV文件这是值得的。然而,我在服务器端使用PHP。 – James 2010-02-28 15:04:40