2012-06-18 55 views
0

我正嘗試將圖像和文檔上傳到遠程服務器。遠程服務器有處理上傳的PHP頁面。請求發送成功,但沒有到達服務器。我正在使用ASIHTTPREQUEST。這裏是代碼:沒有數據到達服務器

-(void)uploadFile 
{ 
    NSString *resume [email protected]"0"; 
    NSUserDefaults *userCredentials =[NSUserDefaults standardUserDefaults]; 
    NSString *userName =[userCredentials objectForKey:@"userName"]; 
    NSLog(@"Media Type : %@",selectedMediaType); 
    NSLog(@"User Name : %@",[userCredentials objectForKey:@"userName"]); 
    NSLog(@"File Name : %@",delegate.fileName); 
    NSString *stringToAppend =[NSString stringWithFormat:@"mediatype=%@&file_name=%@&usrname=%@&filesize=%@&sha256sum=%@&resume=%@",selectedMediaType,delegate.fileName,userName,fileSize,fileSHA256Sum,resume]; 
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://briareos.code20.com/putmedia.php?%@",stringToAppend ]]; 
    uploadMedia = [ASIHTTPRequest requestWithURL:url]; 
    NSLog(@"URL WITH INFO %@",url); 
    [uploadMedia appendPostData:dataToUpload]; 
    [uploadMedia setDelegate:self]; 
    [uploadMedia setRequestMethod:@"PUT"]; 
    [uploadMedia startAsynchronous]; 

} 

有人可以讓我知道可能是什麼問題?

回答

0

有沒有錯誤?嘗試

NSError *error = [uploadMedia error]; 
if (!error) { 
    NSString *response = [uploadMedia responseString]; 
} else { 
    // catch your error here 
} 

附加到你的代碼

+0

沒有錯誤。 –

相關問題