0

I have the following URL

http:actionname.php?user=username&password=pwd&sender=no&audio_file=somefilehere

I want to send an audio file along with the above parameters.

Is it possible to send an audio file as a request parameter?

Thanks in advance...

4

2 回答 2

1

You can send the name of a file, but not the file itself. URL lengths are limited, practically to about 2000 characters. Theoretically they may be a bit longer, but this is not supported on all browsers. See this answer.

If the file is publicly available, and the file name is a URL itself, the server may fetch the file later.

If you want to send a file, consider having a POST request with the file content in it.

于 2013-08-08T06:58:43.150 回答
0

As usually, you will send anything as request to web server, the file content will be transferred as internals of HTTP message (POST parameters as file name, and content separately) outgoing from you to the server, until it finished (it is TCP session and it won't be break up while data is streaming), it could be considered as "request" to web server.

Theoretically, you could send something via URL (HTTP GET request), but you could develop some kind of transport data-over-HTTP-GET protocol to send escaped binary data chunks as GET parameters. It is possible :)

Even sending (uploading) file via POST request also no so plain as submitting form with usual POST parameters, you should use multipart/form-data encoding in the form and special treatment on the server side for that.

It is not good, but not so weird as transmitting data via URL, you could send some data within GET request to the server, look here for more.

于 2013-08-08T07:05:40.457 回答