uploading images to a directory in server
Posted: Fri Nov 29, 2013 4:26 pm
Hi,
this is the program i have for uploading a file to a directory specified. i have the client program in java which asks for the path and filename to upload. the uploading works from the java end. the server side is php program that gets that file and stores it in a directory called uploads. im not able to see the image there. i get the upload success message though.
heres the code...
<?php
error_reporting(E_ALL | E_STRICT);
$filename=$_GET['fileName'];
$fileData=file_get_contents('php://input');
$fhandle=fopen("./uploads/".$filename, 'wb');
fwrite($fhandle, $fileData);
fclose($fhandle);
echo("Done uploading");
?>
my logs say theres a problem with the fwrite and fclose first parameters(have to be resource boolean...)...im not able to figure out how to debug this....any help is appreciated.thanks
this is the program i have for uploading a file to a directory specified. i have the client program in java which asks for the path and filename to upload. the uploading works from the java end. the server side is php program that gets that file and stores it in a directory called uploads. im not able to see the image there. i get the upload success message though.
heres the code...
<?php
error_reporting(E_ALL | E_STRICT);
$filename=$_GET['fileName'];
$fileData=file_get_contents('php://input');
$fhandle=fopen("./uploads/".$filename, 'wb');
fwrite($fhandle, $fileData);
fclose($fhandle);
echo("Done uploading");
?>
my logs say theres a problem with the fwrite and fclose first parameters(have to be resource boolean...)...im not able to figure out how to debug this....any help is appreciated.thanks