如何将自定义字段添加到 POST

发布于 2025-01-09 19:33:10 字数 1077 浏览 0 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文