开发者

why ajax postback not making fileupload textbox empty

In my view i have like this :

<input type="file" id="uploadFile" name="uploadFile" />
<input type="button" id="uploadButton" value="Addfile" onclick="uploadfile()" />

the javascript is like this :

> function uploadfile() {
>       var uploadFile = document.getElementById("uploadFil开发者_运维问答e").value;
>         $.ajax({
>             type: "POST",
>             url: "/controller/actionmethod",
>             data : "uploadFile=" +uploadFile
>             
>           });

    }

my problem is why my textbox not empty after this ajax call coming back to same view.

because i need to upload(save file names) multiple files with that ajax call.

thanks in advance.


You cannot upload files using AJAX. For example there is the jquery form plugin which allows this but behind the scenes it uses a hidden iframe to simulate an AJAX request.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜