0

lets say I have this code :

 try { // open a URL connection to the Servlet
               FileInputStream fileInputStream = new FileInputStream(sourceFile);
               URL url = new URL(upLoadServerUri);
               conn = (HttpURLConnection) url.openConnection(); // Open a HTTP  connection to  the URL
               conn.setDoInput(true); // Allow Inputs
               conn.setDoOutput(true); // Allow Outputs
               conn.setUseCaches(false); // Don't use a Cached Copy
               conn.setRequestMethod("POST");
               conn.setRequestProperty("Connection", "Keep-Alive");
               conn.setRequestProperty("ENCTYPE", "multipart/form-data");
               conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
               conn.setRequestProperty("uploaded_file", fileName); 
               dos = new DataOutputStream(conn.getOutputStream());

               dos.writeBytes(twoHyphens + boundary + lineEnd); 
               dos.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\""+ fileName + "\"" + lineEnd);
               dos.writeBytes(lineEnd);
.
.
.

}

PHP server side:

<?php

    $file_name = $_FILES['uploaded_file']['name'];

    if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $file_name)) {

        //Save the file details into the database 

        echo "success";
    } else{
        echo "fail";
    }
?>

How can I send multiple parameters ? I don't want to send only the file name , I want also to send lets say cell number , etc..

Is there any way to implement the idea ?

AmirM86
  • 113
  • 1
  • 4
  • 11

0 Answers0