Home > Backend Development > PHP Tutorial > Move files to a directory and create the folder if it does not exist.

Move files to a directory and create the folder if it does not exist.

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-28 08:27:08
Original
1567 people have browsed it

function hover_file($file_url,$file_name){
//Determine and create the folder
$y=date('Y',time());//Year
$m=date('m',time()) ;
if(!is_dir('../../../attachment/images/'.$y.$m)){
mkdir('../../../attachment/images/'. $y.$m,0777);//The folder with the creation year + month has the highest permissions
}
//Get the image path and move it
$text=$file_url;//Picture path 1
// $file_url;
// $file_url;
$text1=$file_name;//Picture path 2
$text1;
rename(iconv("UTF-8","GBK",$text),iconv("UTF-8","GBK ",$text1));
}
//-

The above has introduced how to move files to a certain directory and create the folder if it does not exist, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template