简体   繁体   English

如何删除未选择的文件,并在输入类型文件中使用jquery成功上传文件名

[英]how to remove no file selected and place the file name which is uploaded successfully using jquery in input type file

I am uploading a file using servlet and once it is successfull shows a message "Upload success". 我正在使用servlet上传文件,一旦成功显示消息“上传成功”。

But once upload is done the filename next to input file shows "no file selected". 但是一旦完成上传,输入文件旁边的文件名就显示“没有文件被选中”。

I need to show the file name once upload is success in input type file. 我需要在输入类型文件中上传成功后显示文件名。

How to do it using jquery/javascript 如何使用jquery / javascript来做到这一点

var filename = $('input[type=file]').val().split('\\').pop();

选择后,或点击上传后作为第一个动作更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用jQuery从输入类型文件中获取选定的文件名和文件路径 - How to get selected file name and file path from input type file using jQuery jQuery抓取一个用input type ='file'上传的文件 - jQuery grab a file uploaded with input type='file' 如何使用输入类型文件对上传的文件进行编码和解码 - How to encode and decode the uploaded file using input type file 更改输入类型文件选择的名称文件 - Change name File selected by input type file 如何显示在输入类型文件中选择了哪个文件? - How to show which file is selected in Input type File? 如何使用jQuery动态添加/删除文件类型输入字段? - How to dynamically Add/Remove file type input field using jquery? 如果使用ajax jquery文件上载来上传文件,如何在php中获取上载的文件名 - How to get the Uploaded file name in php if the file is uploaded by using ajax jquery file upload 删除选择的文件名以输入多个 - Remove selected file name for input multiple 如何在更改时获取所选文件的完整路径<input type="‘file’">使用 javascript,jquery-ajax? - How to get full path of selected file on change of <input type=‘file’> using javascript, jquery-ajax? 如何使用获取所选文件的完整路径<Input Type=“file” /> - How to get a full path of a selected file using <Input Type=“file” />
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM