防止在asyncfileupload中显示伪路径 [英] Preventing fakepath display in asyncfileupload

查看:64
本文介绍了防止在asyncfileupload中显示伪路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





当我选择一个文件时,我只想在AsyncFileUpload控件中显示文件名而不是伪路径。我见过很多关于相同要求的帖子,但适用于输入控件而不适用于AsyncfileUpload。请告诉我们如何在AsyncfileUpload中实现相同目的。



我尝试过:



我尝试过以下方法。但这从未执行过。试图在OnClientUploadComplete中实现它,但是怀疑并且没有继续。

Hi,

When I select a file , I just want to show the filename rather than the fakepath in AsyncFileUpload control. I have seen numerous posts regarding the same requirement but applicable to input control and not AsyncfileUpload. Please let me know how can we achieve the same in AsyncfileUpload.

What I have tried:

I have tried the below method. But this is never executed. Tried to implement it in OnClientUploadComplete, but got doubtful and didn't proceed.

$('input[type=file]').on('change', function (e) {
   debugger;
   var filename = $(e.currentTarget).val().replace(/^.*\\/, "");
   alert(filename);
});





Divya



Divya

推荐答案

' input [type = file]')。on(' change' function (e){
debugger ;
VAR filename =
('input[type=file]').on('change', function (e) { debugger; var filename =


(e.currentTarget).val()。replace(/^.* \\ /, );
alert(filename);
});
(e.currentTarget).val().replace(/^.*\\/, ""); alert(filename); });





Divya



Divya


此讨论 - AsyncFileUpload问题ASP.NET论坛 [ ^ ]有答案。看看。
This discussion - AsyncFileUpload problem | The ASP.NET Forums[^] has answers. Take a look.


这篇关于防止在asyncfileupload中显示伪路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆