如何将自定义字段添加到 POST
我正在使用 VB6 将文件上传到我的服务器。
这是我的代码:
POST /upload.php? HTTP/1.0
Host: somedomain.com
Content-Type: multipart/form-data, boundary=uzTxw5X5HVmtcWrFhatyjH2QGVcMlBj2
Content-Length: 127289
--uzTxw5X5HVmtcWrFhatyjH2QGVcMlBj2
Content-Disposition: form-data; name="file"; filename="C:/Program Files (x86)/Microsoft Visual Studio/VB98/dtctlsu.oca"; realpath="C:/Program Files (x86)/Microsoft Visual Studio/VB98/dtctlsu.oca"
Content-Type: application/octet-stream
--uzTxw5X5HVmtcWrFhatyjH2QGVcMlBj2--
我现在想在我的 POST 中添加另一个字段,在其中传递文件在客户端计算机上的位置。
正如您所看到的,我尝试简单地使用
realpath="C:/Program Files (x86)/Microsoft Visual Studio/VB98/dtctlsu.oca"
This 来添加它,但没有成功。
<?php
move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
$path = "uploads/";
$name = $_FILES["file"]["name"];
echo "fullpath1: . $_FILES["file"]["full_path"];
echo "fullpath2: . $_POST["realpath"];
?>
两个变量都是空的。
我需要做什么才能让它发挥作用?
谢谢你!
I am uploading a file to my server using VB6.
Here is my code:
POST /upload.php? HTTP/1.0
Host: somedomain.com
Content-Type: multipart/form-data, boundary=uzTxw5X5HVmtcWrFhatyjH2QGVcMlBj2
Content-Length: 127289
--uzTxw5X5HVmtcWrFhatyjH2QGVcMlBj2
Content-Disposition: form-data; name="file"; filename="C:/Program Files (x86)/Microsoft Visual Studio/VB98/dtctlsu.oca"; realpath="C:/Program Files (x86)/Microsoft Visual Studio/VB98/dtctlsu.oca"
Content-Type: application/octet-stream
--uzTxw5X5HVmtcWrFhatyjH2QGVcMlBj2--
I would now like to add another field to my POST in which I pass the file's location on the client computer.
As you can see, I have tried to simply add it using
realpath="C:/Program Files (x86)/Microsoft Visual Studio/VB98/dtctlsu.oca"
This did not work.
<?php
move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
$path = "uploads/";
$name = $_FILES["file"]["name"];
echo "fullpath1: . $_FILES["file"]["full_path"];
echo "fullpath2: . $_POST["realpath"];
?>
Both variables are empty.
What do I have to do to make it work?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论