Choosing File Upload Destination from dropdown

Reply

Join Date: May 2006
Posts: 37
Reputation: sandbox is an unknown quantity at this point 
Solved Threads: 1
sandbox's Avatar
sandbox sandbox is offline Offline
Light Poster

Choosing File Upload Destination from dropdown

 
0
  #1
Feb 4th, 2007
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
piratemon.day.be - My grass is always greener
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 138
Reputation: php_daemon is an unknown quantity at this point 
Solved Threads: 2
php_daemon php_daemon is offline Offline
Junior Poster

Re: Choosing File Upload Destination from dropdown

 
0
  #2
Feb 7th, 2007
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().
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 197
Reputation: vssp has a little shameless behaviour in the past 
Solved Threads: 5
vssp vssp is offline Offline
Junior Poster

Re: Choosing File Upload Destination from dropdown

 
0
  #3
Feb 8th, 2007
Hi

"Copy " command also using to upload the file
Thanks
VSSP
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC