Reputation: 61
I am using the following line to upload a file with a file name taken from a MySQL query. It correctly adds the file to the images folder
move_uploaded_file($file_tmp,"images/".$_SESSION['loggedStudent']['studentID'].".".$file_ext);
However, I want to put the images in to a folder within the 'images' folder called 'profilepics'
But the following doesn't work. The image doesn't appear in the folder
move_uploaded_file($file_tmp,"images/profilepics/".$_SESSION['loggedStudent']['studentID'].".".$file_ext);
Is this a permission issue or is my code wrong? How can I rectify this? I'm using MacOS and running Apache on it
Upvotes: 1
Views: 35
Reputation:
$destFile = "/root/mysite/upload_files/".$_FILES['file']['name'];
move_uploaded_file( $_FILES['file']['tmp_name'], $destFile );
Upvotes: 1