PHP:将文件上传到本地Ubuntu服务器
问题描述:
我一直在处理一个简单的表单,它将Excel文件上传到服务器并对其进行处理,然后给我下载它的选项。PHP:将文件上传到本地Ubuntu服务器
在我的WAMP服务器上,它完美的工作!
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--
可以采取什么问题:
其发送到处理它的文件后上传到本地Ubuntu的服务器,我得到的“网络”这个错误后?
我想也许是因为没有权限的上传文件,所以我发现这个职位: Enabling write permissions Ubuntu Server in var/www/image directory
和使用:
[email protected]:/var/www/html# sudo chmod 664 *
[email protected]:/var/www/html# sudo find . -type d -exec chmod 755 "{}" \;
是否有上传文件,以不同的方式Linux服务器比本地WAMP服务器?
答
对于那些上传土地特定的文件夹,请确保您有权限为777,由Indrasinh
+0
这就是我所做的,现在一切正常。 但问题是......这是正确的+安全的方式来做到这一点? 我打开了一个新的职位:http://*.com/questions/35769507/php-and-chmod-permissions-uploading-a-file-to-my-server-and-saving-a-new-one -wi –
的建议是没有任何错误的'在/ var /日志/的Apache2/error.log'? – NDM
'PHP警告:move_uploaded_file(upload/56d71e3a0b1447.4.xlsx):无法打开流:权限在第46行/var/www/html/PHPExcel/main.php中被拒绝,引用者:http://10.0.0.94/ PHPExcel /' 我有:'如果($ FILE_SIZE> 0){ \t \t \t \t \t \t \t \t $ file_name_new = uniqid( '',真)。 '' 。 $ file_ext; \t \t \t \t $ destination =“upload/$ file_name_new”; \t \t \t \t \t \t \t \t move_uploaded_file($ file_tmp,$目的地); \t \t \t}' –
非常简单的兄弟只允许上传文件夹777的权限,这就是全部! –