openerp - How to upload image from android to Odoo -


i used xml-rpc upload image, worked me, slow! image size 3.5m , took 3 minutes upload

    hashmap map = new hashmap();     map.put("res_model", res_model);     map.put("res_name", res_name);     map.put("type", "binary");     map.put("res_field","image");     map.put("res_id", res_id);     map.put("name", "image");     map.put("datas", image2base64(imagepath));     models.execute("execute_kw", aslist(                 db, uid, password,                 "ir.attachment", "create",                 aslist(map)         )); 

and image2base64 method:

    private string image2base64(string path){     file file = new file(path);     string str = null;     try {         // reading image file file system         fileinputstream imageinfile = new fileinputstream(file);         byte imagedata[] = new byte[(int) file.length()];         imageinfile.read(imagedata);          imageinfile.close();         str = base64.encode(imagedata);      } catch (filenotfoundexception e) {         e.printstacktrace();     } catch (ioexception ioe) {         ioe.printstacktrace();     }      return str; } 


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -