【发布时间】:2011-09-14 10:31:26
【问题描述】:
当我的按钮点击正在处理时,有什么方法可以显示显示“正在上传..”的标签?
我就是这样做的
`
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);
}
}
}
`
但它显示在我的文件已经上传之后。
我做错了吗?还是有其他方法可以做到这一点?
【问题讨论】:
-
数据库处理在哪里完成?
-
你是使用标准的 asp.net FileUpload 控件还是其他东西来上传?
标签: c#