I've got a Java REST based web service sitting on a server which is acc开发者_Python百科essed via a PHP web application on a separate server.
The PHP app delegates the actions performed by browser clients to the web service. I want to perform a file upload function to the web service via HTTP POST and PUT. The browser clients will use POST to upload a file to the PHP app and then will POST or PUT the file to the web service.
Do I have upload files to the PHP server, wait for the upload to finish and then upload that file to the Java web service? Or can I somehow bounce the file upload along to the Java server as it's happening? Or maybe there's some other solution?
Thanks.
This is maybe a poor answer, but I think it might help clarify your question, and maybe give you insight into how to investigate further.
So it seems like your question is in 2 parts : 1) Does PHP get handed off to before a POST operation has uploaded all it's data. I think the answer to this is no, and ends the rest of the debate (but don't take my word for it).
and 2) if the answer to #1 is yes, is there some kind of way to deliver the file on a stream over to the other web service. I think the answer to that question is "maybe".
Either way, you can bypass the question entirely by writing your own little desktop app for people to install, or tell them to use an ftp program, or 500 other things... If you are trying to solve a particular problem, I'm pretty sure it's solvable... you just might not like the implications of what it will require you to do... For instance, you could always go in and patch apache/php to make sure behavior #1 is present on your server :)
Why not just provide the client the link to upload directly to the REST interface? What value is the PHP application adding to the process of uploading?
精彩评论