I want to upload a file on a client (website), then send the audio file (let's say .wav) to a web-server where it can be processed. How do I do this? What would the HTTP POST request look like?
Related
Please forgive me if it seems a silly question, I have this doubt and couldn't find the answer on the web.
How browser and any other downloader downloads a file, which protocol is working at the backend HTTP or FTP.
As we all know HTTP can be used to transfer text, which can be rendered by the browser. It can also send binary data.
Let's say I want to access a webpage at www.xyz.com/index.aspx which has a static webpage with 2 images. As we all know a total of 3 HTTP requests will be made, one for webpage and other 2 for images.
But what about other files which have a big size. I mean suppose I'm downloading an mp3/mp4 files (having link given on the webpage). So, what protocol is working at the backend HTTP or FTP.
It depends on the url :
ftp://www.example.com/bla/bla/bla01.zip
will be fetched via ftp, and
http://www.example.com/bla/bla/bla01.zip
will be fetched via http
Of course we cannot simply change http:// with ftp:// as http need an http server, and ftp need an ftp server.
When initiating a file download from the browser, I would send the server a request for the file. I know that the server then returns a response with content-type either as attachment or application/octect-stream. This lets the browser know that it should initiate the file download.
What I want to know is, how is the file data sent from the server to the client once the response has already be returned? Does it use a different protocol than http? is it always streamed from the server? or is the full file content sent in the response and then the browser just downloads it onto the client machine without maintaining a connection to the remote server?
Is there a way to know when this process has finished from either the server or the client?
The content of the the file being downloaded is included in the response. Response headers are followed by an empty line and then you have actual file data.
I want to retrieve only the last x seconds of a MP4 file located on a remote http server thanks to 'Range' HTTP Header.
How can I know which bytes I need to retrieve? Is there the file structure somewhere?
I am trying to create a web server which has some clients, the webserver has some users(unregistered) which request some files and web server should send the requested file to users. Now my question is how the web server should send back the file? I do not want to make it like a ftp server, so should I create a socket and send file? what are other web servers doing to send the file?
The server will have to listen on some interface. Clients will start the process and connect to the server by opening a socket and request some content. On the same connection the server will respond with the requested content or an error.
Clients (usually browsers) communicate with Web servers using HTTP. At http://www.ietf.org/rfc/rfc2616.txt you can find the description of the protocol. For basic stuff it is quite simple.
Not much changes if the client asks for an HTML file (a web page) or some other file. In the header of the server's response (the first part sent), the client will find some information about the type of content, so that he knows how to display it. The header is followed by the actual data (file or some program generated data).
Hope this helps
I've read something that looks wired to me!
I was reading an article that said HTTP uses FTP to transfer files!
I want to know is it true? if yes, how it transfers?
I mean how it can distinguish if it's a file and it's transferable over FTP? for example I can read a file with PHP and send it to user or just create a link to file! in both, headers can be same but in first case, it's impossible to transfer it over FTP!!!
Edit: I really appreciate if you provide me a good resource on this issue!
HTTP doesn't use FTP to transfer files. HTTP is a protocol in it's own right (HyperText Transfer Protocol) rather than FTP (File Transfer Protocol) but both use TCP transport layer.
the protocol hierarchy is
{http,ftp,xxx} -> {tcp,udp} -> ip
http and ftp are on the same layer(application layer)
have a look at Internet_protocol_suite
Yeah HTTP and FTP both run on the TCP protocol and do not piggy back on one another.
No HTTP don't use FTP for file transfer, but some HTTP client libraries like curl can handle both HTTP & FTP, and of course a web page can have ftp://some.org/some/ftp.link links
FTP is perhaps slightly faster, but is more complex and uses 2 connections (one for data, one for control).
There are many resources (and even books) on HTTP and FTP. I found good Shiflett's HTTP Developer's Handbook but there are many many others. Go to a library to find them.