Example 1 : Multi Files Upload
HTML :
<form action="" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="file" id="file" multiple>
<input type="submit" value="Upload Image" name="submit">
</form>
PHP :
$validation = ["file"=>"mime=png,jpg,gif|multiple=true"];
$file = new \Utilities\File\Files('file',$validation);
$result = $file->store('/');
echo '<pre>';
print_r($result);
Example 2 : Parallel Files send
HTML :
<form action="" method="post" enctype="multipart/form-data">
Select image for Profile:
<input type="file" name="file1" id="file1"><br/>
Select image for Background:
<input type="file" name="file2" id="file2"><br/>
<input type="submit" value="Upload Images" name="submit">
</form>
PHP :
$validation = [
"file1"=>"mime=png,jpg,gif",
"file2"=>"mime=png,jpg,gif"
];
$store_path = [
"file1"=>"images/profile",
"file2"=>"images/background"
];
$store_name = [
"file1"=>"myProfile",
"file2"=>"myBackground"
];
$file = new \Utilities\File\Files(['file1','file2'],$validation);
$result = $file->store($store_path,$store_name);
echo '<pre>';
print_r($result);
|