Men iPhone ilovamdan berilgan PHP sahifasiga mp3 faylni yuklamoqchiman. Buning uchun men ASIFormDataRequest sinfini topdim. Endi men ilovamda shunday kod yaratdim:
NSLog(@"fastBackwardButtonLoosened - sending the stuff");
NSString *theUrl = @"MyServerURL";//Sorry not showing this:)
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:theUrl]];
[request setFile:[soundFileURL absoluteString] forKey:@"mainfile"];
[request startSynchronous];
NSLog(@"The request was sent!!");
Biroq, bu so'rov ichida mp3 ga ishora qiluvchi NSURL ni qanday qo'yishni tushunolmayapman. Men yuqoridagilarni sinab ko'rdim, lekin meni to'g'ri yo'nalishga ko'rsatadigan hech narsa topa olmadim.. Har qanday fikr?
So'rovni qabul qiladigan kod quyidagicha:
$SafeFile = $HTTP_POST_FILES['mainfile']['name'];
$uploaddir = "uploads/";
$path = $uploaddir.$SafeFile;
if($mainfile != none){ //AS LONG AS A FILE WAS SELECTED...
if(copy($HTTP_POST_FILES['mainfile']['tmp_name'], $path)){ //IF IT HAS BEEN COPIED...
//Good
} else {
//Bad
}
}