Changeset View
Changeset View
Standalone View
Standalone View
core/units/helpers/upload_helper.php
Show All 34 Lines | |||||
@set_time_limit(5 * 60); | @set_time_limit(5 * 60); | ||||
} | } | ||||
/** | /** | ||||
* Handles the upload. | * Handles the upload. | ||||
* | * | ||||
* @param kEvent $event Event. | * @param kEvent $event Event. | ||||
* | * | ||||
* @return string | * @return array | ||||
* @throws kUploaderException When upload could not be handled properly. | * @throws kUploaderException When upload could not be handled properly. | ||||
*/ | */ | ||||
public function handle(kEvent $event) | public function handle(kEvent $event) | ||||
{ | { | ||||
$this->disableBrowserCache(); | $this->disableBrowserCache(); | ||||
// Uncomment this one to fake upload time | // Uncomment this one to fake upload time | ||||
// sleep(5); | // sleep(5); | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
$thumbs_path = preg_replace('/^' . preg_quote(FULL_PATH, '/') . '/', '', $tmp_path, 1); | $thumbs_path = preg_replace('/^' . preg_quote(FULL_PATH, '/') . '/', '', $tmp_path, 1); | ||||
$thumbs_path = FULL_PATH . THUMBS_PATH . $thumbs_path; | $thumbs_path = FULL_PATH . THUMBS_PATH . $thumbs_path; | ||||
if ( file_exists($thumbs_path) ) { | if ( file_exists($thumbs_path) ) { | ||||
$this->deleteTempFiles($thumbs_path); | $this->deleteTempFiles($thumbs_path); | ||||
} | } | ||||
return preg_replace('/^' . preg_quote($id, '/') . '_/', '', $filename); | // Add display name/size of uploaded file. | ||||
return array( | |||||
preg_replace('/^' . preg_quote($id, '/') . '_/', '', $filename), | |||||
filesize($file_path), | |||||
); | |||||
} | } | ||||
/** | /** | ||||
* Resizes uploaded file. | * Resizes uploaded file. | ||||
* | * | ||||
* @param string $file_path File path. | * @param string $file_path File path. | ||||
* @param string $format Format. | * @param string $format Format. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |