Skip to content

Commit 63e47da

Browse files
committed
Added UploadHandler attributes upload_url and thumbnails_url.
1 parent bddba7a commit 63e47da

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

example/upload.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* jQuery File Upload Plugin PHP Example 4.2
3+
* jQuery File Upload Plugin PHP Example 4.2.1
44
* https://github.com/blueimp/jQuery-File-Upload
55
*
66
* Copyright 2010, Sebastian Tschan
@@ -27,7 +27,9 @@
2727
class UploadHandler
2828
{
2929
private $upload_dir;
30+
private $upload_url;
3031
private $thumbnails_dir;
32+
private $thumbnails_url;
3133
private $thumbnail_max_width;
3234
private $thumbnail_max_height;
3335
private $field_name;
@@ -147,7 +149,8 @@ private function handle_file_upload($uploaded_file, $name, $size, $type) {
147149
}
148150

149151
public function get() {
150-
$file_name = isset($_REQUEST['file']) ? basename(stripslashes($_REQUEST['file'])) : null;
152+
$file_name = isset($_REQUEST['file']) ?
153+
basename(stripslashes($_REQUEST['file'])) : null;
151154
if ($file_name) {
152155
$info = $this->get_file_object($file_name);
153156
} else {
@@ -180,12 +183,12 @@ public function post() {
180183
} else {
181184
$info = $this->handle_file_upload(
182185
$upload['tmp_name'],
183-
isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] :
184-
$upload['name'],
185-
isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] :
186-
$upload['size'],
187-
isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] :
188-
$upload['type']
186+
isset($_SERVER['HTTP_X_FILE_NAME']) ?
187+
$_SERVER['HTTP_X_FILE_NAME'] : $upload['name'],
188+
isset($_SERVER['HTTP_X_FILE_SIZE']) ?
189+
$_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'],
190+
isset($_SERVER['HTTP_X_FILE_TYPE']) ?
191+
$_SERVER['HTTP_X_FILE_TYPE'] : $upload['type']
189192
);
190193
}
191194
} else {
@@ -201,7 +204,8 @@ public function post() {
201204
}
202205

203206
public function delete() {
204-
$file_name = isset($_REQUEST['file']) ? basename(stripslashes($_REQUEST['file'])) : null;
207+
$file_name = isset($_REQUEST['file']) ?
208+
basename(stripslashes($_REQUEST['file'])) : null;
205209
$file_path = $this->upload_dir.$file_name;
206210
$thumbnail_path = $this->thumbnails_dir.$file_name;
207211
$success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);

0 commit comments

Comments
 (0)