1

I am a newbie to web technologies. While I am reading about jsp/servlet technology (more specifically get and post method) I found some limitations of get method -

  • We can send fewer data with get method compared to post method.
  • Get method only supports character data while post method supports binary data.
    So I think I can send image to a server using post method. Please correct me if I'm wrong
  • Generally get method is used to get some data from the server/database.

Now my question is If get method doesn't support binary data and get method usually used to receive data from server/database how the images/video file are displayed in browser?

Thanks

1 Answers1

2

I'm not going to get into the differences from GET and POST, there are plenty of good resources on the web for that. I do think you're confused about how GET works.

GET is used to request information from a server. It has nothing to do with what type of data is returned. The server can return anything it's designed to return.(i.e. images, etc) . Think of GET as a URL request. You pass a querystring in a URL, which is information you want to send the server.

You could theoretically send the server a file, but you can't pass binary data in a URL unless you base64 encode it. (which turns the binary into characters) You would normally want to use POST for something like that.

Rick S
  • 6,476
  • 5
  • 29
  • 43