-
-
//$file_path=iconv("utf-8","gb2312","C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures \Completely reached.jpg"); - /* if(!copy("C:\Winter.jpg","D:\aa.jpg")){
- echo "error";
- }else{
- echo "OK ";
- }
- */
//Chinese must be transcoded, otherwise an error will be reported
- $file_path=iconv("utf-8","gb2312","C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg");
- if(!copy($file_path,"D:\baa.jpg")){
- echo "error";
- }else{
- echo "OK";
- }
- ?>
-
Copy code
2. Creation and deletion of folders, creation and deletion of files
-
-
- /**
- *Creation and deletion of files and folders
- *edit bbs.it-home.org
- */
- //***********Create folder************
- /* if(mkdir("d:/pwmm")){
- echo "OK";
- }else{
- echo "error";
- }
- */
- //First determine whether the file name exists is_dir("d:/pwmm ") ||file_exists("d:/pwmm")
- /*
- if(!is_dir("d:/pwmm")){
- if(mkdir("d:/pwmm")){
echo "Folder created successfully";
- }else{
echo "Folder creation failed";
- }
- }else{
- echo "Folder already exists";
- }
- */
//*********Create a multi-level directory************
/* $path="D:/pwm/aaa/bbb/ccc" ;
- if(!is_dir($path)){
if(mkdir($path,0777,true)){
echo "Folder creation Success";
- }else{
echo "File creation failed";
- }
- }else{
- echo "The folder already exists";
- }
- */
- //*********Delete directory
- //If there are files or directories in the directory, the deletion will be unsuccessful
- /* if(rmdir("d:/test11")){
- echo "OK";
- }else{
- echo "error";
- }
- */
-
- //************Create file
- //Create test.txt in the directory of test2 on drive d
- /* $path="d:/test2/test.txt";
- $fp=fopen( $path,"w+");
- fwrite($fp,"how are you");
- fclose($fp);
- echo "OK";
- */
//****************Delete file
- $path="d:/test2/test.txt";
- if(is_file($path)){
- if( unlink($path)){
- echo "Deletion successful";
- }else{
- echo "Deletion failed";
- }
- }else{
- echo "File does not exist";
- }
- ?>
-
Copy code
|