form表单图片上传,当没有选择图片时,文件储存地址会出现没有后缀名的图片

越来越好。 2017-11-15 11:24:09
我写了一个简单的form表单来做文件上传,不知道为什么当我没有选择文件,只修改了一些其他信息,提交表单后,虽然数据库图片的地址没有受到影响,但是我文件上传的文件夹里面总会多出一些没有后缀的图片,不知道这是为什么,有什么解决的办法吗?
下面是代码

<form id="formobj" action="${webRoot}/sys/changeLogo" name="formobj" method="post" enctype="multipart/form-data">
<div id="div1">
<table style="width: 550px;margin:0 auto;vertical-align: middle;margin-top:3%;" class="formtable" cellspacing="1">
<tr>
<td align="right"><label class="Validform_label"> 自定义logo: </label></td>
<td class="value" style="height: 45px;">
<input type="file" id="file" name="file" value="选择图片" >
<a href='#' class='ace_button' style="margin-left: 2%;" onclick="scone();"> <i class=' fa fa-trash-o'></i>清空</a>
<span class="begin" id="text" style="color: red;">请选择 jpg,jpeg,bmp,png 等格式的图片!</span>
</td>
</tr>

</table>
<div class="bot" style="width: auto;height: auto;margin:11px 41%;;">
<a id="but_sub" onclick="change()" href="#" class="easyui-linkbutton" plain="true" icon="icon-save">提交</a>
</div>
</div>
</form>



当我没有选择图片提交时,虽然数据库不受影响但是文件的保存地址却出现了这个
...全文
274 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
越来越好。 2017-11-15
  • 打赏
  • 举报
回复
如果有解决办法,最好是写在后台的,,,前端的也可以,我用的是 submit的提交方法。

87,902

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧