拍摄照片并将其发送到使用Android的网络服务器

时间:2012-03-16 10:49:40

标签: android json base64

我必须发送一张从设备中删除的照片并将其发送到网络服务

接收图像的远程方法具有此形式

@Webservice(paramNames = {"id", "title", "fileBase64", "ext"}, description = "Add a receipt to the post.")
    public Response addReceipt(Integer id, String title, String fileBase64, String ext) throws Exception {
        User us = getUserLogged();
        PostService ps = new PostService();
        Post p = (Post) ps.read(idPost);
        if (us == null || !u.getUser().getId().equals(us.getId())) {
            return ErrorResponse.getIllegalOperationResponse(id, logger);
        }
        FileManager fm = new FileManager();
        String fileName = fm.saveReceipt(fileBase64, ext);
        PostReceipt pr = as.addReceipt(u, title, fileName);
        return new Response(new ReceiptJson(pr), null, id);
    }

所以问题是:

- 如何拍照

- 如何将照片编码为基础64以将其放入Json

{"id", "title", "fileBase64", "ext"}

我必须发送到描述的方法:

0 个答案:

没有答案