PHP file upload not working with dynamic path

Posted by Devdarsh on Stack Overflow See other posts from Stack Overflow or by Devdarsh
Published on 2010-04-04T14:19:22Z Indexed on 2010/04/04 14:23 UTC
Read the original article Hit count: 168

Filed under:
|

i am trying to write a php upload script to upload files to different folders. My code works for direct path (something like 'path/to/directory') but not for dynamic path taken from runtime.

$directory_self = dirname($_SERVER['PHP_SELF']);
$folder = $_POST['folder_name']; //final folder
$toupload = $_SERVER['DOCUMENT_ROOT'] . $directory_self .'/files'. $folder;
$uploadsDirectory = str_replace (" ", "", $toupload);

When i echo $uploadsDirectory it shows the exact path. Could any one help me what could be wrong in this?

© Stack Overflow or respective owner

Related posts about php

Related posts about fileupload