不要采用删除当前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. ElasticSearch入门知识扫盲

    ElasticSearch 入门介绍 tags: 第三方 lucene [toc] 1. what Elastic Search(ES)是什么 全文检索和lucene 全文检索 优点:高效,准确,分词 ...

  2. 关于androidAsyncHttp支持https

    一.AsyncHttpClient asycnHttpClient = new AsyncHttpClient(true, 80, 443); 二.或者参照源码,添加证书验证 You need imp ...

  3. [C++程序设计]全局,局部变量

    在函数声明中出现的参数名,其作用范围只在 本行的括号内.实际上,编译系统对函数声明中的 变量名是忽略的,即使在调用函数时也没有为它们 分配存储单元.例如 int max(int a,int b); ┆ ...

  4. linux----ulimit 限制

    ulimit -a 显示当前用户的各种限制. ulimit -n 的数值表示每个进程可以打开的文件数目. 一般情况下, ulimit -n 的数值是1024. 当进程打开的文件数目超过此限制时,该进程 ...

  5. Arcgis api For silverlight 加载QQ地图

    原文 http://www.cnblogs.com/thinkaspx/archive/2012/11/07/2759079.html //本篇博客仅在技术上探讨可行性   //如果要使用Q 地图,请 ...

  6. python实现词法分析

    #请先安装Ply # -*- coding: utf-8 -*- #------------------------------------------------------------------ ...

  7. Headroom.js

    下载 Development (3.7kB) Production (1.7kB) Headroom.js 是什么? Headroom.js 是一个轻量级.高性能的JS小工具(不依赖任何工具库!),它 ...

  8. LeeCode-Sort Colors

    Given an array with n objects colored red, white or blue, sort them so that objects of the same colo ...

  9. Gson的基本使用方法(google)

    原文:http://www.jianshu.com/p/e740196225a4 原作者:怪盗kidou 依赖包配置: <dependency> <groupId>com.go ...

  10. 改变UITableViewCell按下去的颜色

    UIView *bgColorView = [[UIView alloc] init]; [bgColorView setBackgroundColor:[UIColor redColor]]; [c ...