imusing Asihttprequest to upload file to a server, i have 2 questions :
- the progressView is not moving smoothly, in fact it move to the and when upload is finish.
- when i try to upload a big image (> 2 mo approximately ) the upload fail .
hers is my code :
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http:xxxxx" ]];
[request setDownloadProgressDelegate:progresse];
[request setPostValue:@"upload" forKey:@"action"];
[request addData:[NSData dataWithData:UIImageJPEGRepresentation([UIImage imageNamed:@"xxxxx.jpg"],0.9)] withFileName:@"img.jpg" andContentType:@"image/jpeg" forKey:@"img"];
[request startAsynchronous];
server side :
if(isset($_FILES['img']))
{
$dossier = 'upload/';
$fichier = basename($_FILES['img']['name']);
if(move_uploaded_file($_FILES['img']['tmp_name'], $dossier . $fichier))
{
echo 'ok!';
}
else
{
echo 'fail !';
}
}
think you.