android how to upload images to the server? ?<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) -> Reply: http, through DataOutputStream output stream byte [] array write pictures ... Many resources upload pictures of demo Reply: There are several ways to die 1 Use HttpClient to upload, Enity which can contain file object 2 images can be compiled into Base64 string sent to the server (as a suitable picture smaller) Reply:
Well you have sent me the next example. . E-mail: 2688759@qq.com Reply:
Well you have sent me the next example. . E-mail: 2688759@qq.com Reply:
But I was in the picture when converted to base64 encode a problem Reply:
Can be converted to binary and then spread to the database can also be uploaded via ftp, Here is transformed into a binary stream,
/ ** * Photo transfer byte binary * @ Param imagepath need to turn byte photographs path * @ Return has turned into a byte * @ Throws Exception * / public static byte [] readStream (String imagepath) throws Exception { FileInputStream fs = new FileInputStream (imagepath); ByteArrayOutputStream outStream = new ByteArrayOutputStream (); byte [] buffer = new byte [1024]; int len = 0; while (-1! = (len = fs.read (buffer))) { outStream.write (buffer, 0, len); } outStream.close (); fs.close (); return outStream.toByteArray (); } Reply:
Is not the first picture in the client and then converted to a binary stream binary stream as a parameter to the server to the server for conversion to a picture? Reply:
The server how to write ah? Reply:
The reply was deleted administrator at 2013-05-25 10:53:51
Reply: This is what,,,, the landlord did not understand
No comments:
Post a Comment