Ok, the first thing you need to realized is that "fileToUpload" isn't correct. You have to use the name that is being transmitted by the Java application, which in this case is "IMG_1909_jpg" according to the print_r output. Secondly, it isn't saying "Stored in: Array", the "Array" comes from the print_r, you just don't have a new line separating them.
You should also make sure yo check the output of move_uploaded_file.
Like this:
php
<?php
//YOU should make the java code POST using a standardized name
$postVariable = "IMG_1909_jpg"
$uploaddir = '/www/';
$uploadfile = $uploaddir . basename($_FILES[$postVariable]["name"]);
$file_name = "image.jpg";
if ($_FILES[$postVariable]["error"] > 0 || !move_uploaded_file($_FILES[$postVariable]["tmp_name"], $uploadfile))
{
echo "Apologies, an error has occurred.";
if(isset($_FILES[$postVariable]["error"])) echo "Error Code: " . $_FILES[$postVariable]["error"];
}
else
{
echo "Stored in: " . "" . $_FILES[$postVariable]["name"];
}
$handle = fopen($file_name, "w");
fputs($handle, $_FILES[$postVariable]["name"]);
fclose($handle);
?>
Also, why are you writing the filename into "image.jpg"? That doesn't really make sense...
What is that fputs supposed to be doing?
You are also attempting to save the file into "/www/", which is probably wrong. You should make a subdirectory for uploaded files and put them in there. Make sure that you set the folder permissions so that PHP can write the file successfully, otherwise it will give you an error every time.
Per