-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathupload.php
More file actions
30 lines (24 loc) · 701 Bytes
/
Copy pathupload.php
File metadata and controls
30 lines (24 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<form enctype="multipart/form-data" method="post" action="upload.php">
<input type="file" size="32" name="image_field" value="">
<input type="submit" name="Submit" value="upload">
</form>
<?php
require_once('vendor/autoload.php');
use Verot\Upload\Upload;
if($_POST) {
mkdir('images');
$handle = new Upload($_FILES['image_field']);
if ($handle->uploaded) {
$handle->file_new_name_body = 'image_resized';
$handle->image_resize = true;
$handle->image_x = 100;
$handle->image_ratio_y = true;
$handle->process('images/');
if ($handle->processed) {
echo 'image resized';
$handle->clean();
} else {
echo 'error : ' . $handle->error;
}
}
}