-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.php
34 lines (30 loc) · 976 Bytes
/
upload.php
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
31
32
33
34
<?php session_start();
$_SESSION['file_name'] = false;
require('UploadHandler.php');
$upload_handler = new UploadHandler(
array(
'accept_file_types' => '/\.(gif|jpe?g|png)$/i',
'user_dirs' => true,
'print_response' => false,
'image_versions' => array(
// The empty image version key defines options for the original image:
'' => array(
// Automatically rotate images based on EXIF meta data:
'auto_orient' => true
),
'thumbnail' => array(
'max_width' => 200,
'max_height' => 200,
),
),
)
);
//get default
$responseFromUploader = $upload_handler->get_response();
$files = $responseFromUploader['files'];
$absPath = false;
foreach ($files as $file) {
$_SESSION['file_name'] = $file->name;
}
header('Content-type: application/json');
echo json_encode($upload_handler->get_response());