PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi again,
i'm trying to download files, but I keep getting an error that the file doesn't exist. But it does. I have the permissions to my uploads folder set to 777, even though I'm not supposed to, and if i remove the if file_exists statement i get an error saying :
Warning: readfile(http://www.subversivemash.com/uploads/302366.m4a): failed to open stream: No such file or directory in /var/www/html/download_file.php on line 10
also if i try to just type the url to the file in my uploads folder, it doesn't work, i get a page not found error.
the $_GET['upname'] is sent from another page.
if i can't get the file to download when i type the url into my browser, then there's probably no way php can get it either right? is this something with my server? i have the permissions to the uploads folder set to 777.
i'm trying to download files that are stored in an upload folder.
i'm using php4.3, so readfile() doesn't work. I don't really understand the get_file_contents() that ambush commander sent, so i don't know how to use it in my script. i also tried to use the header() function, but that was a no go too.
sorry to keep asking such stupid questions.
are these recently uploaded files, as in, this script is an uploaded file processor? Or is it simply a file downloader?
At any rate, you don't use URL's to get access to it from php, instead use the local file system paths so php can open the file and transmit as needed.
Do you know the system path to the upload folder? If you don't, do you know where it is in relation to the webroot?
right now, the upload folder is in my root directory (the same as the script), until I can get this working.
the scripts are uploaded from a different script.
i've tried lots of variations on the file name/path, including local and not local. this code returns a failed to open stream, no such file or directory error.
ok, so I got to the file, I realized it was downloading, but pumping out all this crazy data, like it's not reading the file correctly. so i added these headers to tell it how to handle the file.
but this is causing another error. it says Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/html/download_file.php on line 6 I'm also getting an error because the headers say info was already sent to the url, makes sense for the 2nd and 3rd, but not the first.