0

I have a Java Swing application that needs to upload a file to the server. My server is a an Apache. I know that I can do this with a Servlet but I don't want to install/maintain a Tomcat server. So I'am wondering is it possible to do it with a PHP script in the server side ?

Thanks

1 Answer 1

1

Well you can do that using jakarta HttpClient library

"Upload file HttpClient"

The article has both server side (php) and client side (java) code

you need to specify the folder on the PHP code, it is already doing through the method

move_uploaded_file ($_FILES['userfile'] ['tmp_name'], $_FILES['userfile'] ['name']); 

This function checks to ensure that the file designated by $_FILES['userfile'] ['tmp_name'] is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by $_FILES['userfile'] ['name'].

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, but how you set the destination folder ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.