S
S
Saymon_K2015-02-01 18:11:28
PHP
Saymon_K, 2015-02-01 18:11:28

What PHP script is needed to upload a file to the server?

There are a lot of examples on the Internet of how you can upload a file, but they all use an html form to do this. And I now need to upload a file to the server from a Java program. Those. The Java program creates an output stream and sends the file to the server by calling the script. And here the script must somehow process this incoming stream and, having collected it in a file, save it where I need it.
I don't know how to write such a script. Yes, I don’t know what there, I don’t understand much in PHP at all. I thought, maybe someone will be so kind and push me in the right direction, articles where this has already been implemented? Or maybe someone has already encountered such a problem?
Is it really possible to transfer a file without a form?
PS I would write the server part in Java, but the server does not allow it. And please do not write, they say, change the server! I can't and that's it... (

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
FanatPHP, 2015-02-01
@FanatPHP

What PHP script is needed to upload a file to the server?

Any.
The server script does not depend on the client.
Therefore, you do not need to write anything in PHP - you just need to take the ready-made code from the example that uses the html form.

A
Albert Tobacco, 2015-02-01
@bighoc

If you will be transferring a file, you will need to transfer the appropriate header.
Well, if you do everything correctly, then your file will be located on the server in the $_FILES global array.

P
Petro Boyko, 2015-02-01
@boykopetro

Here collect works fine

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question