I have a folder structure like this:
etc
files
public_html
tmp
I want users of my website to be able to upload files, and have those files stored inside the files
folder (as opposed to storing them inside some folder within public_html
). This is for security reasons. I'm a bit of a newbie, and I'm having trouble figuring out how to store the uploaded file to the files
folder. Here is my code (the relevant part?):
$path = dirname( __FILE__ ) ."/" . 'files/my_file.pdf';
$success = move_uploaded_file( $tmp_name, $path );
How should I change $path
to get this to work?
It is hard to say where you files are being uploaded to with knowing what the value for FRAMEWORK_PATH
is. If you specifically want to put a file to the location of your choosing just specify it explicitly like:
$path = '/path/to/files/';
$filename = 'name_you_want_to_give_upload';
$success = move_uploaded_file($tmp_name, $path . $filename);