Cant Upload Image To Server Using Asynchttpclient In Android
I am using AsyncHttpClient for uploading image and data to server.But data and image are not uploaded. I dont know what mistake i have done. Can anyone help me? My Code: package co
Solution 1:
replace
params.put("img",myFile);
with
params.put("img",new FileInputStream(myFile));
Solution 2:
The mistake what i done here is, i am sending image file using 'img' keyword. But in php file, i have used different keyword to accept. Thats the problem, now i changed keyword to img(as same in android code). now its working fine.
$target_path2 = $target_path1 . basename($randno.$_FILES['img']['name']);
if(move_uploaded_file($_FILES['img']['tmp_name'], $target_path2)) {
echo"The first file ". basename($randno. $_FILES['img']['name']).
" has been uploaded.";
Thanks to all who helped me.
Post a Comment for "Cant Upload Image To Server Using Asynchttpclient In Android"