dongzhun8449 2017-03-20 08:02
浏览 19

当文件[]被多次打开时,先前的上载将被删除

I am creating and using a custom image uploader within my form which is submitted via ajax - everything works perfect.

I am allowing users to upload multiple images e.g:

<input type="file" name="files[]" accept="image/*" class="files-data" id="upload_images" multiple="">

The problem that I am facing, is that when a user clicks the "Image Upload Button" multiple times, each time the input (the array of previously uploaded images) is reset.

So if a user uploads 3 images, great - that works fine. But if they decide to open the file upload again and upload another image or two, the original 3 files are gone.

I am not looking for a plugin to do this, and I know that this can be done from other image uploaders I have seen.

Do you know how I can maintain previously uploaded images when the multiple input field is opened more than once?

Thank-you for any help.

  • 写回答

2条回答 默认 最新

  • duanla1996 2017-03-20 08:27
    关注

    This is the default behavior of HTML. You need to manage those uploaded files via javascript/jQuery in order to maintain the user selection and for which the plugins you are trying to escape from will do that for you :)

    评论

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值