I am using this code to upload files, but when I upload a file to one folder it works , but when I want to upload a file to folder inside a folder, it doesn’t work ,, as in the following code ..
$imageFile = $_FILES['origialImg']['tmp_name'];
$filename = basename( $_FILES['origialImg']['name']);
if(strstr($_FILES["origialImg"]["type"],"image")){
list($width, $height) = getimagesize($imageFile);
$src = imagecreatefromjpeg($imageFile);
$orig_h = ($height/$width)* $orig_w;
$tmp = imagecreatetruecolor($orig_w, $orig_h);
imagecopyresampled($tmp, $src, 0,0,0,0,$orig_w,$orig_h,$width,$height);
imagejpeg($tmp, $folder1."/".$folder2."/".$filename,100);
imagedestroy($tmp);
imagedestroy($src);
edit
yes, this is the error reporting
Warning: imagejpeg(): Unable to open 'images/big/216389_10150266713175744_609155743_9327201_766531_n.jpg' for writing: Permission denied in /var/www/GazaPlaces/account/photos.php
So it works when you upload a file to a folder but it doesn’t work when you upload a file to a folder in that folder?
Check the folder exists and that you have permission to upload into it, you can CHMOD the folder using your FTP client.
To see if the folder is there use: file_exists().
You can CHMOD the folder using php with chmod().