【发布时间】:2019-05-16 17:25:10
【问题描述】:
发送 POST 方法文件到服务器没有文件。似乎有些人躲避我需要一个脚本来“解析”文件,但是据我了解 POST,文件应该 POST 并被复制到 apache 服务器,即使我什么都不做,对吗?
我已经尝试了许多修改.htaccess、php.ini 和apache2.conf 的解决方案。
目前我有
Apache2.conf
<Directory /var/www/>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) $1.php [L]
RewriteCond %{REQUEST_FILENAME}.xml -f
RewriteRule (.*) $1.xml [L]
</IfModule>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
.htaccess
DirectorySlash Off
php.ini(upload_tmp_dir 不确定是否放置完整路径或来自 web 根目录。我也已阅读将其放在引号中)
file_uploads = On
upload_tmp_dir = /var/www/html/eSCL/ScanJobs
Web 根目录是 /var/www/html 我想上传到 /var/www/html/eSCL/ScanJobs 扫描作业文件夹的权限为 777 所有者 www-data(适用于 ubuntu)
2 个帖子的错误是 404,一个是用于测试的 CURL,另一个是用于扫描的 Mopria Android 应用程序。
卷曲
curl -v -X POST -d @scansettings.xml
http://localhost:80/eSCL/ScanJobs
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)
> POST /eSCL/ScanJobs HTTP/1.1
> Host: localhost
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 605
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 605 out of 605 bytes
< HTTP/1.1 404 Not Found
< Date: Thu, 16 May 2019 17:14:32 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Content-Length: 286
< Content-Type: text/html; charset=iso-8859-1
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /eSCL/ScanJobs was not found on this server.
</p>
<hr>
<address>Apache/2.4.18 (Ubuntu) Server at localhost Port 80</address>
</body></html>
* Connection #0 to host localhost left intact
上述 CURL 请求的 Apache 日志条目
127.0.0.1 - - [16/May/2019:12:14:32 -0500] "POST /eSCL/ScanJobs HTTP/1.1" 404 447 "-" "curl/7.47.0"
在使用 Mopria 的 Apache 日志中(包括成功命中)
192.168.0.8 - - [16/May/2019:12:17:59 -0500] "GET /eSCL/ScannerStatus HTTP/1.1" 200 716 "-" "okhttp/3.9.1"
192.168.0.8 - - [16/May/2019:12:18:04 -0500] "GET /eSCL/ScannerStatus HTTP/1.1" 200 715 "-" "okhttp/3.9.1"
192.168.0.8 - - [16/May/2019:12:18:09 -0500] "GET /eSCL/ScannerStatus HTTP/1.1" 200 715 "-" "okhttp/3.9.1"
192.168.0.8 - - [16/May/2019:12:18:13 -0500] "GET /eSCL/ScannerCapabilities HTTP/1.1" 200 1389 "-" "okhttp/3.9.1"
192.168.0.8 - - [16/May/2019:12:18:13 -0500] "GET /eSCL/ScannerStatus HTTP/1.1" 200 715 "-" "okhttp/3.9.1"
192.168.0.8 - - [16/May/2019:12:18:16 -0500] "GET /eSCL/ScannerStatus HTTP/1.1" 200 716 "-" "okhttp/3.9.1"
192.168.0.8 - - [16/May/2019:12:18:20 -0500] "GET /eSCL/ScannerCapabilities HTTP/1.1" 200 1389 "-" "okhttp/3.9.1"
192.168.0.8 - - [16/May/2019:12:18:20 -0500] "GET /eSCL/ScannerStatus HTTP/1.1" 200 715 "-" "okhttp/3.9.1"
192.168.0.8 - - [16/May/2019:12:18:25 -0500] "POST /eSCL/ScanJobs HTTP/1.1" 404 506 "-" "okhttp/3.9.1"
192.168.0.8 - - [16/May/2019:12:18:25 -0500] "GET /eSCL/ScannerStatus HTTP/1.1" 200 715 "-" "okhttp/3.9.1"
192.168.0.8 - - [16/May/2019:12:18:30 -0500] "GET /eSCL/ScannerStatus HTTP/1.1" 200 715 "-" "okhttp/3.9.1"
192.168.0.8 - - [16/May/2019:12:18:35 -0500] "GET /eSCL/ScannerStatus HTTP/1.1" 200 715 "-" "okhttp/3.9.1"
【问题讨论】: