dextrocity Posted March 26, 2008 Share Posted March 26, 2008 Hi guys Be patient total newbie here. How can we create a folder, check if the folder name already exist and upload a file to that folder. The system should check first if a folder of the same name exist, if it does then the system will not create a new folder but upload the file on that folder. Please help, thanks. Link to comment https://forums.phpfreaks.com/topic/97907-create-folder-upload-file/ Share on other sites More sharing options...
ohdang888 Posted March 26, 2008 Share Posted March 26, 2008 what are you uploading.... text files or other? Link to comment https://forums.phpfreaks.com/topic/97907-create-folder-upload-file/#findComment-500922 Share on other sites More sharing options...
TRI0N Posted March 26, 2008 Share Posted March 26, 2008 Note: Your "upload" root directory needs to be chmod 766 rwx-rw-rw-. Link to comment https://forums.phpfreaks.com/topic/97907-create-folder-upload-file/#findComment-500925 Share on other sites More sharing options...
dextrocity Posted March 26, 2008 Author Share Posted March 26, 2008 hi sorry - how can we do this thru php... like there is a form or a web page. no file restrictions - anyone can upload any file Link to comment https://forums.phpfreaks.com/topic/97907-create-folder-upload-file/#findComment-500991 Share on other sites More sharing options...
ansarka Posted March 26, 2008 Share Posted March 26, 2008 chk the function move_uploaded_file // to upload file mkdir() // to make directory Link to comment https://forums.phpfreaks.com/topic/97907-create-folder-upload-file/#findComment-501013 Share on other sites More sharing options...
nibbo Posted March 26, 2008 Share Posted March 26, 2008 The system should check first if a folder of the same name exist, if it does then the system will not create a new folder but upload the file on that folder. Use the following code to create a directory if it does not already exist: if ( !is_dir('dirName') ) { mkdir('dirName'); } It is probably best to check that it worked afterwards with another is_dir test. Link to comment https://forums.phpfreaks.com/topic/97907-create-folder-upload-file/#findComment-501018 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.