java 模拟触屏版QQ空间上传图片

模拟触屏版QQ空间上传图片问题。

第一步:上传图片。

参数:

picture:【图片的Base64编码】base64:1hd_height:480【图片高度】hd_width:320【图片宽度】hd_quality:96【图片质量,好像只有70&96 ,数字大是高质量】output_type:jsonpreupload:1charset:utf-8output_charset:utf-8logintype:sidExif_CameraMaker:【照片exif】Exif_CameraModel:【照片exif】Exif_Time:【照片exif】uin:17xxxx19【QQ号】sid:Axxxxxxxxxxxxxxcwn【SID】

头信息:

Accept:*/*Accept-Encoding:gzip, deflateAccept-Language:zh-CN,zh;q=0.8Connection:keep-aliveContent-Length:53497Content-Type:application/x-www-form-urlencodedHost:up.qzone.comOrigin:Referer:?g_f=2425User-Agent:Mozilla/5.0 (iPhone; U; CPU iPhone OS 6_0_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5

返回结果:

{ "filelen" : 20319, "filemd5" : "c8c4211055a01684b2a0bc112a674170b9c6bf323d129c4c923aa869d566e25c"}

图片Base64编码处理方法:

public static String GetImageStr(String imgFilePath) {//byte[] data = null;// 读取图片字节数组try {InputStream in = new FileInputStream(imgFilePath);data = new byte[in.available()];in.read(data);in.close();} catch (IOException e) {e.printStackTrace();}// 对字节数组Base64编码BASE64Encoder encoder = new BASE64Encoder();return encoder.encode(data);// 返回Base64编码过的字节数组字符串 }

第二步:

参数:

output_type=jsonpreupload=2md5=c8c4211055a01684b2a0bc112a674170b9c6bf323d129c4c923aa869d566e25c【第一步返回结果里的filemd5】filelen=20319【第一步返回结果里的filelen】batchid=1425463906390000【new Date().getTime()+"000"】currnum=0uploadNum=1uploadtime=1425463906【(new Date().getTime()+"").substring(0, 10)】uploadtype=1upload_hd=1albumtype=7big_style=1op_src=15001charset=utf-8output_charset=utf-8uin=1xxxx19【QQ号】sid=AVxxxxxxxxxxxxxxcwn【SID】logintype=sidmobile_dc=actiontype%3D2%26subactiontype%3D1%26reserves%3D1%26page_type%3D2%26app_id%3D7003albumid=V1XXX6【相册ID】desc=测试测试【图片描述】platformid=52platformsubid=11

但是返回结果:

{ "picinfo" : { "error" : -400 } }

发现是图片Base64编码 处理部分出错。

不知道怎么做了。

处理图片Base64编码:

,快乐要有悲伤作陪,雨过应该就有天晴。

java 模拟触屏版QQ空间上传图片

相关文章:

你感兴趣的文章:

标签云: