-
Notifications
You must be signed in to change notification settings - Fork 6
file
Zimo Xiao edited this page Mar 8, 2018
·
9 revisions
- upload - store a file
- file::upload($_FILES['name'], $name)
-
-
upload a file with given name
-
file::upload($file['name'], $name); //name can be a path of just a name (auto-store under file folder)
-
return true if success, false otherwise
-
- read - read a file
- file::read($local_path)
-
-
read a file from the specified local path
-
file::read($path); //read multiple files by passing $path as an array of paths
-
returns string
-
- write - write a file
- file::write([$path => $value])
-
-
write in to files from the specified series of paths
-
file::write([ $path_1 => $value_1, $path_2 => $value_2 //your path-value pairs ]);
-
- download - download a file from specified path with the name
- file::download($path, $name, $download_rate)
-
-
download_rate is optional and in kb/s, default value is 20 kb/s
-
file::download($path, $name, 30); //download a file from $path with the speed of 30 kb/s and rename it $name
-
- delete - delete a file
- file::delete($path)
-
-
delete a file from the specified path
-
file::delete($path); //delete multiple files by passing $path as an array of paths
-
- zip - zip a series of files
- file::zip($destination_path, $path_of_initial_files)
-
-
file::zip($local_path,[ $path_of_file_1 => 'rename1.txt', $path_of_file_2 => 'rename2.txt', $path_of_file_3 => 'rename3.txt' ]); //$local_path is the path + zip_name //example: /your/dir/1.zip
-
- unzip - unzip a file
- file::unzip($file, $path)
-
-
file::unzip($zip_path,$extract_to_path);
-
- create - create an empty file
- file::create($dir_and_name);
-
-
file::create([user::dir().'/file/txt/1.txt' ,user::dir().'/file/txt/2.txt']); //create two empty files file::create(user::dir().'/file/txt/1.txt'); //create an empty files
-