java中图片上传失败
HTML代码<divclass="layui-form-item"><labelclass="layui-form-label">资讯图片</label><divclas...
HTML代码
<div class="layui-form-item">
<label class="layui-form-label">资讯图片</label>
<div class="layui-input-inline">
<input type="file" name="pic_1" class="layui-upload-file" lay-title="请添加焦点图1"/>
</div>
<img alt="fileupload1" id="fileupload_1" style="width:40px;height: 40px;display:none" src="" />
<a class="layui-btn layui-btn-danger layui-btn-small" id="delete_1" style="display:none" onclick="deletedPic(this)"><i class="layui-icon"></i>删除</a>
<div class="layui-form-mid layui-word-aux" id="notify_1">(图片大小小于200k 图片比例1:1 690 * 360像素)</div>
</div>
js代码
layui.use('upload', function(){
var layer = layui.layer,
$ = layui.jquery;
layui.upload({
url: 'upload.action?images' //上传接口
,method:'post'
,before: function(input){
//返回的参数item,即为当前的input DOM对象
imgPreview(input);
index =layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
});
},success: function(res,input){ //上传成功后的回调
console.log(res);
layer.close(index);
if(res.success == true){
layer.msg("上传成功");
$("#goodsImgs").val(res.data);
}else{
layer.msg("上传失败");
deletedPic(res.data);
}
}
}); 展开
<div class="layui-form-item">
<label class="layui-form-label">资讯图片</label>
<div class="layui-input-inline">
<input type="file" name="pic_1" class="layui-upload-file" lay-title="请添加焦点图1"/>
</div>
<img alt="fileupload1" id="fileupload_1" style="width:40px;height: 40px;display:none" src="" />
<a class="layui-btn layui-btn-danger layui-btn-small" id="delete_1" style="display:none" onclick="deletedPic(this)"><i class="layui-icon"></i>删除</a>
<div class="layui-form-mid layui-word-aux" id="notify_1">(图片大小小于200k 图片比例1:1 690 * 360像素)</div>
</div>
js代码
layui.use('upload', function(){
var layer = layui.layer,
$ = layui.jquery;
layui.upload({
url: 'upload.action?images' //上传接口
,method:'post'
,before: function(input){
//返回的参数item,即为当前的input DOM对象
imgPreview(input);
index =layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
});
},success: function(res,input){ //上传成功后的回调
console.log(res);
layer.close(index);
if(res.success == true){
layer.msg("上传成功");
$("#goodsImgs").val(res.data);
}else{
layer.msg("上传失败");
deletedPic(res.data);
}
}
}); 展开
1个回答
2017-12-02 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
3种情况
HTTP Status Code: 403 Forbidden
Error Code: RequestTimeToo-Skewed
Description: The difference between the request time and the server's time is too large.
HTTP Status Code: 403 Forbidden
Error Code: RequestTimeToo-Skewed
Description: The difference between the request time and the server's time is too large.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询