SentiJB Posted May 1, 2021 Share Posted May 1, 2021 if(isset($_POST['submit'])) { $target_dir = "uploads/"; $folder_name=$GLOBALS['user']->get('weergegevennaam'); if (!file_exists($target_dir . $folder_name))/* Check folder exists or not */ { @mkdir($target_dir . $folder_name, 0777);/* Create folder by using mkdir function */ echo "Folder Created";/* Success Message */ } $target_file = $target_dir . $folder_name . basename($_FILES['fileToUpload']['name']); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); how can i add a slash in $target_file so it's uploads/$folder_name Link to comment Share on other sites More sharing options...
bsmither Posted May 1, 2021 Share Posted May 1, 2021 I see that $target_dir already has a directory separator (a slash). My concern is that PHP may be making the 'uploads' directory in a place not where you are expecting, because $target_dir is not a a complete path back to the root folder. CubeCart created a constant, CC_ROOT_DIR, for this purpose. So: $target_dir = CC_ROOT_DIR . '/uploads/'; Then $folder_name is appended to that (make sure the value for 'weergegevennaam' is a valid string). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.