I have following problem: I'm developing the application which need to authorize on server and upload data from my mobile into it. The server side is ready and works correctly. So, for authorizing I use the following code:
URL url = new URL(VALIDATING_URL);
                URLConnection connection=url.openConnection();
                connection.setDoOutput(true);
                PrintWriter out=new PrintWriter(connection.getOutputStream());
                out.print(POST_QUERY_EMAIL+email);
                out.print("&");
                out.print(POST_QUERY_PASS+password);
                out.print("&");
                out.print(POST_QUERY_CHANNEL+channel);
                out.close();
                Scanner in=new Scanner(connection.getInputStream());
                StringBuilder result=new StringBuilder();
                while (in.hasNextLine()) {
                    result.append(in.nextLine());
                    result.append("\n");
                }
                in.close();
It works correctly, and the application will get needed result if I enter correctly data. So, now I need to upload data into server using POST-query, but I don't know how I can do it. Using HTML forms, video is usually uploaded using 'userfile' variable and will be got from $_FILES array in PHP scipts. How can I upload do it from Java? Can I just print data into PrintStream from InputStream?
Thank you, I hope you can help me
 
     
     
    