Jump to content

Create folder - upload file


dextrocity

Recommended Posts

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

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.

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.