PHP:将文件上传到本地ubuntu服务器

时间:2016-03-02 16:58:03

标签: php ubuntu file-upload chmod

我一直在处理一个简单的表单,将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服务器不同?

1 个答案:

答案 0 :(得分:0)

对于上传的特定文件夹,请确保您拥有777的权限,如Indrasinh所建议的那样

相关问题