2016-03-02 138 views
1

我一直在處理一個簡單的表單,它將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服務器?

+0

的建議是沒有任何錯誤的'在/ var /日誌/的Apache2/error.log'? – NDM

+1

'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}' –

+2

非常簡單的兄弟只允許上傳文件夾777的權限,這就是全部! –

回答

0

對於那些上傳土地特定的文件夾,請確保您有權限爲777,由Indrasinh

+0

這就是我所做的,現在一切正常。 但問題是......這是正確的+安全的方式來做到這一點? 我打開了一個新的職位:http://stackoverflow.com/questions/35769507/php-and-chmod-permissions-uploading-a-file-to-my-server-and-saving-a-new-one -wi –

相關問題