0

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

3
Contributors
2
Replies
6
Views
10 Years
Discussion Span
Last Post by vssp
0

The trick is to set the upload path from as $_POST instead of a fixed one:

$replace=array("../","./",";");
$path=str_replace($replace,"",$_POST['path']);

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

If you need to dynamically load the directories to select, check out glob().

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.