Uploaded file won't allow download
Posted: Tue Apr 11, 2006 3:43 pm
Jcart | Please use
Again, the upload and delete (unlink) work perfectly fine, but I get the permissions problem when generating a hyperlink to download the files. There are no password protections on the folders the files are located.
Does the "move_uploaded_file" put some sort of protection on it? I'm confused.
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have created a script that will upload a file to the server and store link information in mySQL. The files upload fine, and I can delete them fine via PHP, but if I try to access the files via a hyperlink, I get a 403 error which says "Forbidden. You don't have permission to access (file) on this server."
The code snippet that handles the upload is this:Code: Select all
$uploaddir = '../docs/';
$uploadfile = $uploaddir . basename($_FILES['link']['name']);
if (move_uploaded_file($_FILES['link']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}Does the "move_uploaded_file" put some sort of protection on it? I'm confused.
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]