How do I add a custom field to a POST

Viewed 43

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!

0 Answers
Related