/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] HELP!!! Problem defining file loaction

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=php]if (move_uploaded_file($file_tmp,’uploads/’.$file_name))[/code]

However when attempting to point to a folder (that exists) inside the uploads folder ‘uploads/11’ using a variable in the following code:

[code=php]if (move_uploaded_file($file_tmp, ‘uploads/’.$folder_id.’/’.$file_name))[/code]

I get the error messages:

[QUOTE]

Warning: move_uploaded_file(uploads/ 11 /CV.doc) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:xampphtdocsboxedINupload.php on line 62

[/QUOTE]

[QUOTE]

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘C:xampptmpphp59.tmp’ to ‘uploads/ 11 /CV.doc’ in C:xampphtdocsboxedINupload.php on line 62

[/QUOTE]

Any suggestions?

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@RossBryanauthorApr 09.2012 — Resolved by trimming the white space from the '$folder_id' variable:

[code=php]$folder_id= trim($folder_id);[/code]
×

Success!

Help @RossBryan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.10,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...