benrussell Posted March 12, 2007 Share Posted March 12, 2007 I'm working on an Upload Handler that will upload images to a user's folder. Right now I'm having troubles with mkdir if the user folder is not already created or just creating the file in the folder if it is already created.... I keep getting parse errors on line 28: constant encapsed strings or t-strings, depending on how I try to fix it. I'm trying to act like I know what I'm doing. How's it look so far? (line 28 starts with the mkdir command.) You can try the code yourself at www.christiancountyvideo.com/loginhomemade/login.php <?php session_start(); //---------------------------------------------- // upload file handler script //---------------------------------------------- // // specify file parameter name $file_param_name = 'file'; // // retrieve uploaded file name $file_name = $_FILES[ $file_param_name ][ 'name' ]; // // retrieve uploaded file path (temporary stored by php engine) $source_file_path = $_FILES[ $file_param_name ][ 'tmp_name' ]; // // construct target file path (desired location of uploaded file) - // here we put to the web server document root (i.e. '/home/wwwroot') // using user supplied file name if (file_exists("c:\\Server\\upload\\" . $_SESSION['usuario'])) { $target_file_path = "c:\\Server\\upload\\" . $_SESSION['usuario'] . "\\" . $file_name; } else { mkdir "c:\\Server\\upload\\" . $_SESSION['usuario']; } $target_file_path = "c:\\Server\\upload\\" . $_SESSION['usuario'] . "\\" . $file_name; // // move uploaded file echo "Moving file " . $source_file_path . " > " . $target_file_path . ": "; if( move_uploaded_file( $source_file_path, $target_file_path ) ) { echo "success"; } else{ echo "failure"; } // // below is trace of variables ?> <html> <body> <h1>GET content</h1> <pre><?print_r( $_GET );?></pre> <h1>POST content</h1> <pre><?print_r( $_POST );?></pre> <h1>FILES content</h1> <pre><?print_r( $_FILES );?></pre> </body> Thanks for the help!!! benrussell _________________ I can do this! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.