I\'m trying to upload Image to the Server, Which I have done and works very well. But the problem I\'m facing is I want to Upload Image as well as pass some parameter with t
I have done this recently with PHP CodeIgniter:
/*** POST THIS CODE AFTER
dos = new DataOutputStream(conn.getOutputStream());
***/
dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=mobile_no" + lineEnd); // name=mobile_no so you have to get PHP side using mobile_no
dos.writeBytes(lineEnd);
dos.writeBytes(mobile_number); // mobile_no is String variable
dos.writeBytes(lineEnd);
$mobile_no = $_POST['mobile_no'];
$mobile_no => $this->input->post('mobile_no');
Try this:
$mobileNumber = $_POST['userNumber']; // get mobile number from post
Since you are using POST
method:
conn.setRequestMethod("POST");
And setting mobile number as:
conn.setRequestProperty("userNumber", usernumber);