| | |
Choosing File Upload Destination from dropdown
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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
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
•
•
Join Date: Aug 2006
Posts: 138
Reputation:
Solved Threads: 2
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().
[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().
![]() |
Other Threads in the PHP Forum
- Previous Thread: Identifing all Active sessions in PHP
- Next Thread: Files linked to MySQL records
| Thread Tools | Search this Thread |
Tag cloud for PHP
# .htaccess 5.2.10 access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display dissertation download dynamic echo email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link login loop mail menu mlm mod_rewrite multiple mysql mysqlquery oop open parse paypal pdf persist php problem query radio random recursion regex remote script search server sessions sms soap sockets source space sql structure syntax system table tutorial update upload url validation validator variable video web xml youtube





