Create a folder
| The code is as follows |
Copy Code |
function CreateFolder ($path, $nname) { if (Is_dir ($path) && is_writable ($path)) { if (Preg_match ("/^\w{1,255}$/i", $nname)) { echo mkdir ($path.) /". $nname, 0777)? ' Create folder Success ': ' Create folder Fail '; }else{ echo "Folder Error"; } }else{ echo "Can ' t Create Error file not is_writable or not dir"; } } |
pasting files
function Past ($currentpath, $currentfilename, $filepote) {//1: Where the file is to be pasted 2: The current file {folder} Name 3: The physical address of the file {folder}
$str = substr ($currentfilename, -1,1);
if (substr ($currentfilename, -1,1) = = "|") {
Www.111cn.net
$currentfilename = Str_replace ("|", "", $currentfilename);
$filepote = Str_replace ("|", "", $filepote);
}www.111cn.net
if (Is_dir ($currentpath) && is_writable ($currentpath) && is_dir ($filepote) && is_writable ($ Filepote)) {
Www.111cn.net
@mkdir ($currentpath. " /". $currentfilename);
$t =full_copy ($filepote, $currentpath. " /". $currentfilename)? ' T ': ' F '//$filepote, need copy folder $current Sava folder
Www.111cn.net
}else if (Is_file ($filepote) && file_exists ($filepote)) {
if (File_exists ($currentpath. $currentfilename)) {echo (' file exists! plase rename it! '); Exit;}
echo Copy ($filepote, $currentpath. $currentfilename)? ' Success ': ' Errror ';
Www.111cn.net
}
if ($str = = "|" && $t = ' t ') {
Deldir ($filepote);
Www.111cn.net
}
}
Original article: Reprint please specify www.111cn.net