I am making a phonegap app that includes uploading to a linux server running the LAMP stack.
I have a file called upload.php which contains the following code:
<?php
header('Access-Control-Allow-Origin: *');
$new_image_name = urldecode($_FILES["file"]["name"]).".jpg";
move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/".$new_image_name);
?>
and inside /var/www/html/ I have a folder called uploads with 777 permissions just for testing purposes. This code works perfectly and saves the files in /var/www/html/uploads/. I then created another folder called images within the html folder and it also has 777 permissions but the file will refuse to save in this folder when I run this version of upload.php:
<?php
header('Access-Control-Allow-Origin: *');
$new_image_name = urldecode($_FILES["file"]["name"]).".jpg";
move_uploaded_file($_FILES["file"]["tmp_name"], "images/".$new_image_name);
?>
It may be worth noting that I can also save to directories inside /var/www/html/uploads/ such as /var/www/html/uploads/images/