Hello, I am trying to use the move_uploaded_file() function in a module I’m writing, but when I try and let the user upload a file via a form, here is the error message I get:
Warning: move_uploaded_file(modx/assets/media/storelist.txt) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/mtzionwi/public_html/modx/manager/processors/execute_module.processor.php(114) : eval()’d code on line 44
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ’/var/tmp/phptl055q’ to ’modx/assets/media/storelist.txt’ in /home/mtzionwi/public_html/modx/manager/processors/execute_module.processor.php(114) : eval()’d code on line 44
fail
I am using this code to upload the file:
$target = "modx/assets/media/".basename($filename);
echo "The filename is: $target";
if(move_uploaded_file($_FILES['mediafile']['tmp_name'], $target))
echo "success moving file";
else
echo "fail moving file";
The full path to the folder I want to upload to is: "modx/assets/media"
My directory structure is:
public_html/
modx/
assets/
media/