postmanlabs / postman-chrome-interceptor

Helper extension for the Postman packaged app. Also helps send restricted headers.
Apache License 2.0
215 stars 75 forks source link

Multiple file uploads get sent as one field. #40

Open techsterx opened 9 years ago

techsterx commented 9 years ago

When uploading multiple files using a single File field going through the interceptor, the files as are appended into one file and then sent to server.

Request Preview

POST /filetest.php HTTP/1.1
Host: development.local
Cache-Control: no-cache
Postman-Token: 37b72520-c314-54ce-fa2f-7186b0685beb
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file[]"; filename="09d949d106306a3a5420332b900454fbfa3a84ef"
Content-Type: 

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file[]"; filename="bf4c4b101fd77211999e893d77ff6cff5e1d1c67"
Content-Type: 

----WebKitFormBoundary7MA4YWxkTrZu0gW

Server Sees w/Interceptor

Array
(
    [name] => Array
        (
            [0] => 09d949d106306a3a5420332b900454fbfa3a84ef
        )

    [type] => Array
        (
            [0] => application/octet-stream
        )

    [tmp_name] => Array
        (
            [0] => /tmp/phpyTjlB7
        )

    [error] => Array
        (
            [0] => 0
        )

    [size] => Array
        (
            [0] => 7858
        )

)

Server sees without Interceptor

Array
(
    [name] => Array
        (
            [0] => 09d949d106306a3a5420332b900454fbfa3a84ef
            [1] => bf4c4b101fd77211999e893d77ff6cff5e1d1c67
        )

    [type] => Array
        (
            [0] => application/octet-stream
            [1] => application/octet-stream
        )

    [tmp_name] => Array
        (
            [0] => /tmp/phpk6magk
            [1] => /tmp/phpficARS
        )

    [error] => Array
        (
            [0] => 0
            [1] => 0
        )

    [size] => Array
        (
            [0] => 3927
            [1] => 3931
        )

)
techsterx commented 9 years ago

When using one file field for each file, even if they are named the same (file[] in this case), it works properly.