Page 1 of 1

HELP!!! Problem defining file loaction

Posted: Mon Apr 09, 2012 1:54 am
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?

Re: HELP!!! Problem defining file loaction

Posted: Mon Apr 09, 2012 3:55 am
by RossBryan
Resolved by trimming the white space from the '$folder_id' variable:

Code: Select all

$folder_id= trim($folder_id);