java - sending both audio file and values from android to server -


i know uploading audio in android, can :

final byte[] data = out.tobytearray(); string urlstring = "http://localhost/voiceupload.php"; httppost postrequest = new httppost(urlstring); postrequest.setentity(new  bytearrayentity(data)); //data byte array containing sound in form of bytearray httpclient client = new defaulthttpclient(); 

for uploading simple values can :

arraylist<namevaluepair> postparameters = new arraylist<namevaluepair>(); postparameters.add(new basicnamevaluepair("callid", "8123069127952")); urlencodedformentity formentity = null; try { formentity = new urlencodedformentity(postparameters); } catch (unsupportedencodingexception e1) {   e1.printstacktrace();  } httppost.setentity(formentity); client.execute(postrequest) 

now want send both in 1 post request.i mean want send 1 or more variable values , 1 sound file.can ?

sure. see answer @ post: save received picture folder on web server replace image file sound file. passes 1 value, filename, can add many name-value pairs you'd like.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -