Skip to content

Commit f74ffcc

Browse files
committed
Add webpath to the file info when receive the json after upload
1 parent c4f5696 commit f74ffcc

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

BlueImp/UploadHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ public function post() {
433433
);
434434
}
435435
header('Vary: Accept');
436+
foreach ($info as $key => $item) {
437+
$info[$key]->filePath = substr($item->url, strlen($this->options['webpath']));
438+
$info[$key]->filePath = preg_replace('/(.)\\1/','$1',$info[$key]->filePath);
439+
}
436440
$json = json_encode($info);
437441
$redirect = isset($_REQUEST['redirect']) ?
438442
stripslashes($_REQUEST['redirect']) : null;

Services/FileUploader.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public function handleFileUpload($options = array())
110110
array(
111111
'upload_dir' => $uploadDir,
112112
'upload_url' => $webPath . '/' . $originals['folder'] . '/',
113+
'webpath' => $options['web_base_path'],
113114
'script_url' => $options['request']->getUri(),
114115
'image_versions' => $sizes,
115116
'accept_file_types' => $allowedExtensionsRegex,

0 commit comments

Comments
 (0)