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();

    }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.