不要采用删除当前input[type=file]这个节点,然后再重新创建dom这种方案,这样是不合理的。
解释如下:
input[type=file]使用的是onchange去做,onchange监听的为input的value值,只有再内容发生改变的时候去触发,而value在上传文件的时候保存的是文件的内容,你只需要在上传成功的回调里面,将当前input的value值置空即可。
event.target.value='';

input type file onchange上传文件的过程中,遇到同一个文件二次上传无效的问题。的更多相关文章

  1. input type file onchange上传文件的过程中,同一个文件二次上传无效的问题。

    不要采用删除当前input[type=file]这个节点,然后再重新创建dom这种方案,这样是不合理的.解释如下:input[type=file]使用的是onchange去做,onchange监听的为 ...

  2. js 实现 input type="file" 文件上传示例代码

    在开发中,文件上传必不可少但是它长得又丑.浏览的字样不能换,一般会让其隐藏点其他的标签(图片等)来时实现选择文件上传功能 在开发中,文件上传必不可少,<input type="file ...

  3. [置顶] js 实现 <input type="file" /> 文件上传

    在开发中,文件上传必不可少,<input type="file" /> 是常用的上传标签,但是它长得又丑.浏览的字样不能换,我们一般会用让,<input type ...

  4. <input type="file">上传文件并添加路径到数据库

    注:这里是用的mvc所以没法用控件 html代码 <form method="post" enctype="multipart/form-data"> ...

  5. 文件上传按钮input[type="file"]按钮美化时在IE8中的bug【兼容至IE8】

    首先看一下完成后的效果,鼠标移入可改变为手指的效果. 在此就不加图标了 <label class="file-upload"> <span>上传附件< ...

  6. input type=file实现图片上传

    <label for="file"> <img src="images/morende.jpg" alt=""> & ...

  7. jQuery 在IE下对表单中input type="file"的属性值清除

    对一个文件域(input type=file)使用了验证后,我们总会希望把文件域中的值给清空了,在IE中,由于安全设置的原因,是不允许更改文件域的值的,接下来为大家介绍一下解决方法 一般来说,在对一个 ...

  8. CSS <input type="file">样式设置

    这是最终想要的效果~~~ 实现很简单,div设置背景图片,<input type="file"/>绝对定位上去再设置opacity:0(透明度为0 ) 直接上代码,希望 ...

  9. 上传文件 隐藏input type="file",用text显示

    <div> <span>上传文件:</span> <input type="file" id="upload_file" ...

随机推荐

  1. cocos2d-x创建工程批处理

    cd /d D:\cocos2d-x-2.2.2\cocos2d-x-2.2.2\tools\project-creator create_project.py -project %1 -packag ...

  2. zabbix之3触发器/action及模板

    1.触发器: {server_name:item_name.func.operator.condition} 一旦condition(条件)触发,则item状态改变 触发器之间可以存在依赖关系,即it ...

  3. IIC的标准操作函数集(C51)包含C和H文件

    /********************************************************************* 头文件名 VIIC_C51.H 这个头文件对应的库是VII ...

  4. perl return和break

    zjzc01:/root/test# cat a3.pl sub mask { my $n=shift; my $j =100; for ($i = 1;$i <= 5;$i++){ print ...

  5. uestc poj2559 秋实大哥去打工

    //感觉有必要把这题放博客上待复习 刚刚写解题报告的时候发现自己又不会做这题了 //我不会告诉你这题绝对是命题人抄poj2559 这题使用一个单调递增的栈,栈内存储的元素有两个值,一个高度,一个长度. ...

  6. Letter Combinations of a Phone Number 解答

    Question Given a digit string, return all possible letter combinations that the number could represe ...

  7. Single Number 解答

    Question Given an array of integers, every element appears twice except for one. Find that single on ...

  8. hdu 5610 Baby Ming and Weight lifting

    Problem Description Baby Ming is fond of weight lifting. He has a barbell pole(the weight of which c ...

  9. http://home.cnblogs.com/

    说起编辑器,可能大部分人要推荐的是Vim和Emacs,本人用过Vim,功能确实强大,但是不是很习惯,之前一直有朋友推荐SUblime Text 2这款编辑器,然后这段时间就试了一下,就深深地喜欢上这款 ...

  10. 安装vs2015的时候出现的各种 1402错误

    经搜索与尝试,确认为注册表权限问题,改过好几个子项,均提示不能修改设置子项的所有者什么的,后来一怒之下,直接把install节点下的compom项的权限的administratos权限删掉,删除的时候 ...