Results 1 to 10 of 10

Thread: How do I add a custom field to a POST?

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Question How do I add a custom field to a POST?

    I am uploading a file to my server using VB6 and Winsock.

    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--
    The upload works fine.

    On the server, I would like to know the file's path on the client pc (=> "C:/Program Files (x86)/Microsoft Visual Studio/VB98/dtctlsu.oca").
    That is why I have tried to add a custom field named "realpath" (realpath="C:/Program Files (x86)/Microsoft Visual Studio/VB98/dtctlsu.oca")

    I have tried to get this field in my php script, but it's empty.

    Code:
    <?php
        move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
    
        $path = "uploads/";
        $name = $_FILES["file"]["name"];
        
        $fullpath1 = $_FILES["file"]["realpath"];
        $fullpath2 = $_POST["realpath"];
    
        echo "fullpath: . $fullpath1";
        echo "fullpath: . $fullpath2";
    ?>
    How could I pass a custom field with my POST?

    Thank you!

    ps: I don't have access to php 8.1 yet, so I can't use "full_path".
    Last edited by tmighty2; Feb 25th, 2022 at 07:00 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width