怎么用H5上传图片给阿里云服务器从而拿到url,主要是H5那一块咋写的,有例子吗。
如果是经过后台接口(nutz的入口方法), 那么这事情跟oss没关系了.
用webupload比自己写h5代码方便, http://fex.baidu.com/webuploader/
$('.btn').click(function(){
alert(1);
var i = 1;
$("img").each(function(){
alert($(this).attr("src"));
var url = "/open/file/upload/uploadImageOnly?file=";
$.ajax({
type: "post",
url: url,
data:$(this).attr("src"),
contentType: false,
processData: false,
success: function(results){
if(results.code==0){
var a ="http://dbsd-goods.oss-cn-hangzhou.aliyuncs.com/"+results.data;
console.log(a)
$('#file'+i).val(a);
if(i==2){
i=1;
}
}else{
alert("参数有误!");
}
}
});
});
zepto.min.js:2 POST http://localhost:8080/open/file/upload/uploadImageOnly?file=data:image/jpeg…alehLWaRjjGec+gr5Ku5jcXc0pyS7sx/E5r6i8R/8AIFuf9x//AEE18sVlQfuXPVy1L3n6H//Z 414 (Request-URI Too Long)