PHP will save files to one folder but not another

PHP will save files to one folder but not another



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/





Check ownership of both the folders.
– akshaypjoshi
Sep 2 at 9:18





Both folders are set up with the exact same permissions and owners @akshaypjoshi
– Theo Michail
Sep 2 at 9:26






is there in /var/www/ or in /var/www/html/ or in /var/www/html/uploads/ an .htaccess file (hidden)?
– Andra
Sep 2 at 10:31


/var/www/


/var/www/html/


/var/www/html/uploads/


.htaccess





@Andra no there aren't any hidden files in any of those directories
– Theo Michail
Sep 2 at 10:36





permissions in the virtual host config file?
– Andra
Sep 2 at 10:41






Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế