944,099 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2377
  • PHP RSS
Feb 4th, 2007
0

Choosing File Upload Destination from dropdown

Expand Post »
I've been sitting at my PC atleast 2 hours now trying to figure this out.. so here it goes...


IM relatively new to PHP and im struggling to learn it. I want to create a standard upload form, but i would like to make it so i can choose the folder destination of the file im trying to upload. I.E. from a drop down menu, there would be a list of folders and i would select one. This page has an example of what im looking for:

http://encodable.com/uploaddemo/


Ive googled atleast 50 terms, but no luck. All ive seen are standard upload forms. Ive also searched this forum with no luck... maybe someone could point me in the right direction...

Thankyou in advance
Reputation Points: 10
Solved Threads: 1
Light Poster
sandbox is offline Offline
37 posts
since May 2006
Feb 7th, 2007
0

Re: Choosing File Upload Destination from dropdown

The trick is to set the upload path from as $_POST['path'] instead of a fixed one:
[php]
$replace=array("../","./",";");
$path=str_replace($replace,"",$_POST['path']);

move_uploaded_file($_FILES['file']['tmp_name'],$path."/".$_FILES['file']['name']);
[/php]

If you need to dynamically load the directories to select, check out glob().
Reputation Points: 13
Solved Threads: 2
Junior Poster
php_daemon is offline Offline
138 posts
since Aug 2006
Feb 8th, 2007
0

Re: Choosing File Upload Destination from dropdown

Hi

"Copy " command also using to upload the file
Reputation Points: 5
Solved Threads: 5
Junior Poster
vssp is offline Offline
197 posts
since Jul 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Identifing all Active sessions in PHP
Next Thread in PHP Forum Timeline: Files linked to MySQL records





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC