tomdelonge Posted December 18, 2008 Share Posted December 18, 2008 When i use this script to process my form, the file is uploaded to the same directory as this file. I want it to go to a directory below it, in a folder called "uploads". Where do I put that? I would guess the $destination_path variable needs it somewhere in there, but I'm doing something wrong. It doesn't work. <?php // Edit upload location here $destination_path = getcwd().DIRECTORY_SEPARATOR; $result = 0; $target_path = $destination_path . basename( $_FILES['myfile']['name']); if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) { $result = 1; } sleep(1); ?> Link to comment https://forums.phpfreaks.com/topic/137592-uploading-file-location/ Share on other sites More sharing options...
flyhoney Posted December 18, 2008 Share Posted December 18, 2008 <?php $result = 0; $target_path = '../' . basename( $_FILES['myfile']['name']); if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) { $result = 1; } sleep(1); ?> Link to comment https://forums.phpfreaks.com/topic/137592-uploading-file-location/#findComment-719158 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.