0

I'm trying to send a POST request to get a file downloaded, but I'm having problem complete this operation using URL.

The form looks like this:

<FORM action='download.php' method='post' encType='multipart/form-data'>
    <TD bgcolor="white" valign="top" style="padding:10px;">
    <TABLE cellspacing=0 cellpadding=0 width='100%'>
    <TR>
        <TD width='30%' align='center'>
            Uploaded torrent code (date+hash):<BR>
            <INPUT size=58 name="ref" value="1333f4f84bb41d5adc0f61e8f5a4658460da70b2737" style="font-size:10px;"><INPUT TYPE="hidden" NAME="reff" value="MTM3OTU2Mjk4OQ=="><BR>
            downloaded: 27988<BR>
            <INPUT type="submit" height=27 width=174 value=download border=0 name=submit valign="bottom" onclick="setpos(1);">
        </TD>
    </TR>
    </TABLE>
    </TD>
</FORM>

So I tried to use URL:

www.site.com/download.php?ref=1333f4f84bb41d5adc0f61e8f5a4658460da70b2737

but that doesn't work. Chrome seems to show me a browser based form data:

------WebKitFormBoundaryeqA3pQupG0ndfLMZ
Content-Disposition: form-data; name="ref"

1333f4f84bb41d5adc0f61e8f5a4658460da70b2737
------WebKitFormBoundaryeqA3pQupG0ndfLMZ
Content-Disposition: form-data; name="reff"

MTM3OTQ4NzQwMQ==
------WebKitFormBoundaryeqA3pQupG0ndfLMZ
Content-Disposition: form-data; name="submit"

download
------WebKitFormBoundaryeqA3pQupG0ndfLMZ--

What should I do now?

Yuming Cao
  • 935
  • 1
  • 10
  • 22
  • `multipart/form-data` can't be put in the URL. – Barmar Sep 19 '13 at 04:14
  • 1
    You can't put parameters in the URL if the server script isn't expecting them there. If it's PHP and uses `$_POST`, it requires the parameters to be in the `POST` body. – Barmar Sep 19 '13 at 04:16
  • See this for details: http://stackoverflow.com/questions/3045097/php-redirect-and-send-data-via-post – Yuming Cao Sep 19 '13 at 04:43

1 Answers1

0

Post request can't be made in browser url.

-> This is is first way to do this

Sample post request using curl:

curl -F param1=val1 -F param2=val2 -F param3=val3  http://host:port/abc.json

Hit this in terminal/console/cmd

curl -F ref=1333f4f84bb41d5adc0f61e8f5a4658460da70b2737  www.site.com/download.php

-> Or install RestConsole in chrome browser using Google Web Store. There you can handle every kind of request.

Taimoor Changaiz
  • 10,250
  • 4
  • 49
  • 53