HELP!!! Problem defining file loaction

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!

Moderator: General Moderators

Post Reply
RossBryan
Forum Newbie
Posts: 19
Joined: Fri Aug 19, 2011 3:03 pm

HELP!!! Problem defining file loaction

Post by RossBryan »

Can anybody point me in the right direction of what exactly it is im doing wrong please. Im trying to upload a file to a specific location (folder), it works fine when i simply specify the uploads folder using the following:

Code: Select all

if (move_uploaded_file($file_tmp,'uploads/'.$file_name))
However when attempting to point to a folder (that exists) inside the uploads folder 'uploads/11' using a variable in the following code:

Code: Select all

if (move_uploaded_file($file_tmp, 'uploads/'.$folder_id.'/'.$file_name))
I get the error messages:
Warning: move_uploaded_file(uploads/ 11 /CV.doc) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\xampp\htdocs\boxedIN\upload.php on line 62
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\xampp\tmp\php59.tmp' to 'uploads/ 11 /CV.doc' in C:\xampp\htdocs\boxedIN\upload.php on line 62
Any suggestions?
RossBryan
Forum Newbie
Posts: 19
Joined: Fri Aug 19, 2011 3:03 pm

Re: HELP!!! Problem defining file loaction

Post by RossBryan »

Resolved by trimming the white space from the '$folder_id' variable:

Code: Select all

$folder_id= trim($folder_id);
Post Reply