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

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().

Hi

"Copy " command also using to upload the file

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.