我有一个网站,用户可以上传图片然后下载。我已将我的项目移动到实时网络主机上,但问题是,当我尝试下载我刚刚上传的文件时,它会下载但之后无法打开它,它说它已损坏...我在本地没有问题
继承我的下载行动:
public function getfile($accesskey) {
$this->autoRender = false;
if ($accesskey != null) {
$data = $this->getfileinfo($accesskey);
if (!empty($data)) {
$this->response->file(WWW_ROOT.$data['Document']['dlpath'], array('download' => true, $data['Document']['name']));
return $this->response;
} else {
$this->redirect(array('controller' => 'documents', 'action' => 'upload'));
}
} else {
$this->redirect(array('controller' => 'documents', 'action' => 'upload'));
}
}
$ data ['文档'] [' dlpath']包含以下内容:
/home/vol2_2/byethost17.com/b17_15357734/htdocs/app/webroot/uploads/2014/09/26/filekey/imagename.extension
这是我第一次这样做,所以我可能犯了一个错误......路径错了或者我感到困惑
编辑:似乎我得到的错误比它看起来要深刻得多。我在文本编辑器中打开了corruted文件,看到了一些关于set_time_limit()和php安全模式的错误......这是错误:
Warning (2) : set_time_limit() has been disabled for security reasons [ CORE/Cake/Network/CakeResponse.php , line 1458 ] Code Context
set_time_limit - [internal], line ??
CakeResponse::_sendFile() - CORE/Cake/Network/CakeResponse.php, line 1458
CakeResponse::send() - CORE/Cake/Network/CakeResponse.php, line 429
MediaView::render() - CORE/Cake/View/MediaView.php, line 96
Controller::render() - CORE/Cake/Controller/Controller.php, line 954
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 198
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 165
[main] - APP/webroot/index.php, line 108