sniperscope Posted January 8, 2009 Share Posted January 8, 2009 Hi i am currently using a script which let me create a folder but when i check it via ftp, the script create folder with Nobody owner. So i can not change the permission to upload image. Here is my create folder script <?php $file_name = $_POST['create_folder']; if(is_dir($_POST['create_folder'])){ echo "This file already created."; exit; } else { mkdir("../img/stuff/".$_POST['create_folder']); //echo "File created..."; } header('location: admin_panel.php'); ?> and this part of script is uploading image into created directory. <?php $stuff_name = $_POST['stuff_name']; // Configuration - File type Options $allowed_filetypes = array('.jpg','.gif','.png'); $max_filesize = 524288; $upload_path = 'img/stuff/'.$stuff_name; $upload_path = $upload_path.'/'; $filename = $_FILES['userfile']['name']; $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize) die('The file you attempted to upload is too large.'); if(!is_writable($upload_path)) die('You cannot upload to the specified directory, please CHMOD it to 777.'); // Here is where the error occur. if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename)) else echo 'There was an error during the file upload. Please try again.'; ?> Any help or idea will be great appreciate. Quote Link to comment https://forums.phpfreaks.com/topic/139981-solved-creating-folder-and-uploading-image-to-host/ Share on other sites More sharing options...
sniperscope Posted January 8, 2009 Author Share Posted January 8, 2009 Forget it, i solve it. Quote Link to comment https://forums.phpfreaks.com/topic/139981-solved-creating-folder-and-uploading-image-to-host/#findComment-732371 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.