Android Question HTTP Server Upload Error

GiovanniO

Member
Hello everyone. I'm having an error in the HTTP Server example. When I try to upload a file to my phone from a web browser (on my PC connected to the same network), I get this error:

HTTP ERROR: 500​

Problem accessing /upload/storage%2Femulated%2F0. Reason:

java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io_OutputStream.close()' on a null object reference

As I mentioned, it appears with the compiled example, meaning I haven't made any changes to it. Is there a solution?

Thank you very much for any help.

Best regards.
 

GiovanniO

Member
Are you using the old HttpServer example? Better to avoid.

Thank you very much for your answer Erel. Yes, I'm using the Jetty-based HTTP server, since I need to upload and download a file from any computer in the LAN to an Android device acting as a server.
 
Upvote 0

GiovanniO

Member
Upvote 0
Top