【发布时间】:2016-06-15 16:16:56
【问题描述】:
我一直在研究一个简单的表单,它将 Excel 文件上传到服务器并对其进行操作,然后让我选择下载它。
在我的 WAMP 服务器上,它运行良好!
将其上传到本地 Ubuntu 服务器后,我在将其发送到处理它的文件后在“网络”上收到此错误:
Request URL:http://10.0.0.66/PHPExcel/main.php
Request Method:POST
Status Code:500 Internal Server Error
Remote Address:10.0.0.66:80
Response Headers
view source
Connection:close
Content-Length:1
Content-Type:text/html; charset=UTF-8
Date:Wed, 02 Mar 2016 16:51:42 GMT
Server:Apache/2.4.12 (Ubuntu)
Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:10621
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryTlu6BO9uHeeHBF5X
Cookie:ci_session=1ce8fcaf8b36c7a2cf254077b1682edca9e771e3
Host:10.0.0.66
Origin:http://10.0.0.66
Referer:http://10.0.0.66/PHPExcel/
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
Request Payload
------WebKitFormBoundaryTlu6BO9uHeeHBF5X
Content-Disposition: form-data; name="file"; filename="0103.xlsx"
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
------WebKitFormBoundaryTlu6BO9uHeeHBF5X
Content-Disposition: form-data; name="MOS"
android
------WebKitFormBoundaryTlu6BO9uHeeHBF5X--
可能是什么问题?
我想可能是因为没有上传文件的权限,所以我找到了这个帖子: Enabling write permissions Ubuntu Server in var/www/image directory
并使用:
root@server:/var/www/html# sudo chmod 664 *
root@server:/var/www/html# sudo find . -type d -exec chmod 755 "{}" \;
将文件上传到 Linux 服务器与本地 WAMP 服务器是否有不同的方法?
【问题讨论】:
-
/var/log/apache2/error.log有错误吗? -
PHP Warning: move_uploaded_file(upload/56d71e3a0b1447.40123190.xlsx): failed to open stream: Permission denied in /var/www/html/PHPExcel/main.php on line 46, referer: http://10.0.0.94/PHPExcel/我有:if ($file_size > 0) { $file_name_new = uniqid('', true) . '.' . $file_ext; $destination = "upload/$file_name_new"; move_uploaded_file($file_tmp, $destination); } -
非常简单的兄弟,只需授予上传文件夹 777 的权限即可!!
-
@IndrasinhBihola 工作!
-
但是从安全的角度来看,这不是坏事吗?
标签: php ubuntu file-upload chmod