Hi all,
I am having problems uploading files to a folder structure on the server and am not to sure as to why this is happening.
I have this code which is the upload script:
if (isset($_POST[uploadbutton])) {
$tempimagename = "TMP" . $_FILES['myimage']['name'];
$newimagename = $_FILES['myimage']['name'];
// other code here that is irrelevant etc...
$filedestination = "../myimages/" . strtolower($newimagename );
if(move_uploaded_file($_FILES['myimage']['tmp_name'], $destinationimage)) {
// other code here etc...
}
The problem I am having is that it fails to upload each time and I am not sure if it is a permissions thing. My '../myimages' folder is CHMOD 755.
Is there a way of adding code in that changes the folder to CHMOD 777 then chages it back again or is this not good practice?
Thanks in advance.