Jump to content

creating a new folder with php


FUNKAM35

Recommended Posts

 

 

but dont know how I can make it create a folder named $reference

Do you mean create a folder using the value stored in the $reference variable. If that is the case, you'd just pass that variable to mkdir

mkdir($reference);

If you want to create folder in a specific place, then you'll need to prepend the parent path

mkdir('path/to/patent/folder/'.$reference);
// this is the path to where your folders are located
$basePath = 'path/to/where/folders/go/';
// the folder name you are saving/retrieving in your database.
$reference = 'somefolder';

//this is the full path/to/folder
$folder = $basePath.$reference;

// if the folder doesn't already exist...
if (!file_exists($folder)) {
// create the folder
mkdir($folder);
}

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.