I have set up a apache2 webserver on my raspberry pi (jessie). I have a file upload php script in my /var/www/html/
folder. This script is supposed to upload the file to a /uploads
folder ( /var/www/html/uploads
). The script is:
$folder = "/uploads";
move_uploaded_file($_FILES["filep"]["tmp_name"] , "$folder".$_FILES["filep"]["name"]);
When I try to upload a file, I get upload success message and the name of file gets updated to the database, but when I check the /uploads
folder, I don't see the file. I have given chmod 777 permission
to the folder and changed upload_max_filesize
to 16M
and post_max_size
to 32M
. None of the methods worked.
Is my path wrong or am I missing something?
The folder /uploads
is in your file system root and not under /var/www/html
. To use a folder relative to the current directory leave out the leading /
or use the constant __DIR__
to get the current directory.
$folder = "uploads/";
// or
$folder = __DIR__."/uploads/";
You could also use the complete path to the folder:
$folder = "/var/www/html/uploads/";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.