在java代码中我用了模拟表单的方式上传图片是可以的,但是这里用uploader上传图片,接口能走通,但是后台就是没有读到图片,这是为什么?
![闲情赋](https://img-cdn-tc.dcloud.net.cn/account/identicon/335cc7fcb51b589992226c0a4914a726.png)
闲情赋
- 发布:2015-12-10 22:32
- 更新:2017-09-05 11:34
- 阅读:6100
大神你好,想问问mui 用uploader实现图片上传该这么弄?
分类:MUI
![NSK](http://img-cdn-tc.dcloud.net.cn/uploads/avatar/000/12/17/82_avatar_mid.jpg?v=0)
自己用的
//读取相册,返回base64
pc.gallery = function(obj, fn) {
var f1 = null;
var boundx, boundy, x, y, w, h;
plus.gallery.pick(function(path) {
//处理图片
var img = new Image();
img.src = path; // 传过来的图片
//图片处理
img.onload = function() {
var that = this;
//生成比例
w = 200 || obj.width;
h = 160 || obj.height;
//生成canvas
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
$(canvas).attr({
width: w,
height: h
});
ctx.drawImage(that, 0, 0, w, h);
f1 = canvas.toDataURL('image/jpeg', 1 || 0.8);
//回调
fn(f1);
}
});
}
闲情赋 (作者)
能给一下上传的代码和服务端的接受代码吗?
2015-12-12 17:41
文
解决了没?
2016-04-12 15:28