【发布时间】:2013-12-06 08:41:23
【问题描述】:
我正在使用此代码:(https://github.com/blueimp/jQuery-File-Upload)
error_reporting(E_ALL | E_STRICT);
require('UploadHandler.php');
$option = array(
'upload_dir' => 'myurl',
'SesId' => 1
);
$upload_handler = new UploadHandler($option);
脚本运行正常,但我想在文件上传后做一些事情:
error_reporting(E_ALL | E_STRICT);
require('UploadHandler.php');
$option = array(
'upload_dir' => 'myurl',
'SesId' => 1
);
class CustomUploadHandler extends UploadHandler {
protected function handle_form_data($file, $index) {
$file->SesId = $this->options['SesId'];
}
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index=null, $content_range=null) {
$file = parent::handle_file_upload(
$uploaded_file, $name, $size, $type, $error, $index, $content_range
);
if (empty($file->error)) {
die();
}
return $file;
}
}
$upload_handler = new UploadHandler($option);
文件上传正常,但 NEVER die() ???
我错过了什么?
【问题讨论】:
-
抱歉,上传后
-
我不明白你的问题。上传后有“done”、“fail”、“always”事件以便做某事。但它是客户端。
-
通过 PHP 上传文件,但答案是使用 JQuery。最后的问题是我调用了错误的实例。