2013-04-28 9 views
1

升级到的jquery file upload最新正式发布后:我如何禁用jQuery的文件输出上传

对于PHP UploadHandler.php我得到类似如下的输出:

{ 
    "files": [{ 
     "name": "1367159262-79", 
     "size": 0, 
     "type": "multipart\/form-data; boundary=---------------------------7d115d2a20060c", 
     "error": "abort", 
     "delete_url": "http:\/\/my-site.com\/photos\/?file=1367159262-79", 
     "delete_type": "DELETE", 
     "id": null 
    }] 
} 

我们的应用程序是窒息在这个输出上。

如果我设置print_response为post方法的false,所以我不再看到上面的输出在应用程序方面很好。不幸的是,当我这样做时,我现在看到:空文件上传结果通过网络上传文件后。

return $this->generate_response(
     array($this->options['param_name'] => $files), 
     false 
); 

任何想法,我怎么能消除这个JSON输出,并没有得到空文件上传结果错误?

回答

0

我最终为UploadHandler的cosntructor添加了一个参数,并将它设置为false。有可能是一个更好的办法,但它解决了问题,对我来说:

function __construct($options = null, $initialize = true, $error_messages = null, $print_response = true) { 
    ... 
} 

对于我这样的应用:

$options = null; 
$initialize = true; 
$error_messages = null; 
$print_response = false; 

$upload_handler = new UploadHandler($options, $initialize, $error_messages, $print_response); 
相关问题