有没有办法在按钮点击处理时显示标有“正在上传...”的标签?
我是这样做的
`
protected void btnUpload_Click(object sender,EventArgs e)
{
lblOutput.Text="uploading..";
HttpPostedFile postedFile = FileUpload1.PostedFile;
string ClientFileName, ServerFileName;
if ((FileUpload1.HasFile && FileUpload1.PostedFile != null) || txtUrl.Text!="")
{
try
{
HttpPostedFile myFile = FileUpload1.PostedFile;
if (fileType == "Image")
{
if (fileExt == ".jpg" || fileExt == ".gif" || fileExt == ".png" || fileExt == ".bmp" || fileExt == ".tif")
{
ServerFileName = System.IO.Path.Combine(ServerSavePathI, ClientFileName);
string serverPath = Server.MapPath(ServerFileName);
FileUpload1.SaveAs(serverPath);
dbInsert(fileType, fileName, fileExt, filePath+fileType+"/"+fileName.Replace(" ",string.Empty)+fileExt, url);
}
}
}
`
但是我的文件已经上传后显示了。
我做错了吗?或者还有其他办法吗?
答案 0 :(得分:0)
在btnUpload_Click方法的末尾添加以下代码:ClientScript.RegisterStartupScript(this.GetType(), "FileUploadMessage", "jAlert('success', 'Your file has been uploaded.', 'Success Dialog');", true);