简体   繁体   中英

FileUpload Status Indicator ASP.Net C#

There are other similar posts, but they all want a progress bar. I don't care.

I will probably end up buying Ajax Uploader, but I would like to know if there is a way to just let the user know if a file is in the process of being uploaded. I have tried an Ajax ProgressIndicator but it doesn't work...The file upload part works, but the progresscontent does not get displayed.

Here is what I have without the Ajax:

<asp:FileUpload onchange="clickTheButton();" ID="FileUpload1" runat="server" />
<asp:Button ForeColor="#ffffff" BackColor="#ffffff" BorderColor="#ffffff" BorderWidth="0"
                ID="Button1" runat="server" Text="Add Image" OnClick="AddImage_Click" />

Just a file upload control and a button that uploads the file.

All I need is a way to let the user know that it is busy sending the file.

Why not just create some hidden element on the page like this:

<div id="loadingDiv" style="display: none;">Please wait, uploading file...</div>

and then in the OnClientClick of your upload button, return a function like so:

function displayWaitingMessage(){
    document.getElementById('loadingDiv').style.display = 'block';
    return true;
}

Should display the message and then proceed with the postback to upload the file.

只需使用Ajax以合理的间隔查询服务器,看看您尝试上传的文件是否存在,并根据响应显示适当的指示。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM