0

I am using a java.net.URL.openConnection() to upload 2 text files to my server (Android to PHP). I am using a similar code to this post. I can get one file uploaded fine but can not figure out how to structure the code for two file. I believe my problem is related to this code.

dos.writeBytes(twoHyphens + boundary + lineEnd); 
dos.writeBytes("Content-Disposition: form-data; name='uploaded_file';filename='" + fileName1 + "'" + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name='uploaded_file2';filename='" + fileName2 + "'" + lineEnd);
dos.writeBytes(lineEnd);
Community
  • 1
  • 1
Stingalingaling
  • 173
  • 2
  • 9
  • So in short, you wish to upload 2 or more than two files from your android app. M I right ? – Panda Aug 11 '15 at 17:20
  • Yes - upload two files from my android app – Stingalingaling Aug 11 '15 at 17:41
  • I tried using only one dos.writeBytes("Content-Disposition: form-data... line, adding my two files names to a string array, and looping thru the String array uploadFile(filename) but still only one file gets uploaded. – Stingalingaling Aug 11 '15 at 18:02

0 Answers0