Re: Using POST to send bitmap image with Java



Arne Vajhøj wrote:
Kenneth P. Turvey wrote:
I'm actually in the process of doing this right now. I'm going to be posting the image to a URL that is a PHP script. When I was looking at this I thought that this really made more sense to use a PUT method to post the image, but the guy working on the PHP side insisted on using a POST method.

Is there a reason that POST would be selected over PUT for this application? Are there reasons to go with PUT here?

PUT file

uploads a file to specified name via a builtin mechanism
in the web server.

Apache does not use PUT except via mod_dav (WebDAV). A handler must be built for everything but GET.

POST uploadscript

send a file to the specified script that can save it as
a file or in a database or whatever.

Not all web servers support or is configured to allow PUT,
while POST is supported by all web servers.

While the above statement is true, it is no longer common to disable PUT and DELETE server wide because WebDAV requires both. It was never common to limit POST but the limit has always been available on Apache.

With POST you can also use form based multi part where you
can upload additional info about the file and multiple files
in a single POST.

POST is designed to allow a uniform method to cover the following functions:
- Annotation of existing resources;
- Posting a message to a bulletin board, newsgroup, mailing list,
or similar group of articles;
- Providing a block of data, such as the result of submitting a
form, to a data-handling process;
- Extending a database through an append operation.

The PUT method requests that the enclosed entity be stored under the supplied Request-URI.


The reason why the PHP guy wants a POST may be the following. When you send a PUT, the servers config has to tell it what handler to use - the URI is the target file of the PUT. With a POST, the URI is the handler - no modification of the config needed.


Arne



--
Dave Miller
Java Web Hosting at:
http://www.cheap-jsp-hosting.com/
.



Relevant Pages

  • [Fwd: CERT Advisory CA-2002-05 Multiple Vulnerabilities in PHP fileupload]
    ... Multiple vulnerabilities exist in the PHP scripting language. ... installed on a variety of web servers, including Apache, IIS, Caudium, ... Updates to the PHP packages are in progress ...
    (comp.os.linux.security)
  • Re: System apparently unable to cope with loading
    ... > I have a customer who is having problems when their Windows ... > levels at which PHP should be able to cope? ... > The web servers are each dual-processor Intel machines running IIS5 ... you have to remember that with each "hit" the PHP page must be ...
    (alt.php)
  • Re: System apparently unable to cope with loading
    ... > I have a customer who is having problems when their Windows ... > levels at which PHP should be able to cope? ... > The web servers are each dual-processor Intel machines running IIS5 ... you have to remember that with each "hit" the PHP page must be ...
    (comp.lang.php)
  • Re: Post with redirect?
    ... He wanted a way to redirect a port with data to an external site ... posting certain inputs, with the 3rd party server as the target. ... i made no claim other than you can use just php to get the job done. ... only thing jerry got right is that it would be a lot of work. ...
    (comp.lang.php)
  • Re: Attempt to de-mystify AJAX
    ... created and populated by the PHP script. ... string is initialized in line 1 to the opening select tag. ...
    (comp.databases.pick)