Jump to content

file uploading from java client to php server


How can i recieve the file stream in php which is sent by the java swing program. and how can i test that the file has been updated. after uploading a file i have to process it in php code. any body can please help me.  

  1. 1. How can i recieve the file stream in php which is sent by the java swing program. and how can i test that the file has been updated. after uploading a file i have to process it in php code. any body can please help me.

    • code example
      0
    • debugging method
      0


Recommended Posts

How can i recieve the file stream in php which is sent by the java swing program. and how can i test that the file has been updated. after uploading a file i have to process it in php code. can anybody please help me.

 

here is the function where am sending file (in java)

 

path=http://192.168.100.40/php_prgs/var/www/nsboxng/htdocs/tryupdate.php?&view=ids&dir=Default&file=test1.ids

 

public void updateToServer(String path, File file){//ZipOutputStream zout){

     

        //ZipOutputStream zout = null;

        if (!(path == null || path.equals(""))) {

            try {

                HttpURLConnection conn = create(path);

                //conn.setReadTimeout(300000);  // 5 minutes ??

               

                send(file, conn);

             

            }catch (Exception ex) {

                ex.printStackTrace();

             

            }

          }

     

    }

 

public void send(Object obj, HttpURLConnection conn) throws IOException {

            OutputStream out0;

            out0 = conn.getOutputStream();

            ObjectOutputStream out = new ObjectOutputStream(out0);

            out.writeObject(obj);

            out.flush();

            out.close();

    }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.