如何清除在服务器端的文件上传文本(C#) [英] How to clear file upload text in server side (c#)

查看:191
本文介绍了如何清除在服务器端的文件上传文本(C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要清除的文件上传的文件路径。文件上传更新面板内部,我使用的是 AsyncFileUpload 。我如何清除文件,修改文件上传的背景颜色

btnAudUpload_Click法

 字符串文件名= FileUpload.FileName;
字符串FULLPATH = Path.Combine(@D:\\媒体,文件名);
如果(FileUpload.HasFile)
  {
 如果(filename.ToLower()。的endsWith(MP4))
     {
      //保存文件
     }
  其他
     {
          //我想在这里清除文件上传内容
     }
  }


解决方案

清除属性为我工作...但是,这将消除风格和其他的东西。

 字符串文件名= FileUpload.FileName;
字符串FULLPATH = Path.Combine(@D:\\媒体,文件名);
如果(FileUpload.HasFile)
{
  如果(filename.ToLower()。的endsWith(MP4))
  {
     //保存文件
  }
  其他
  {
     //我想在这里清除文件上传内容
     FileUpload.Attributes.Clear();
  }
}

I want to clear the file path from the file upload. The file upload is inside the update panel and I am using a AsyncFileUpload. How can I clear the file and change the background color of the fileupload

btnAudUpload_Click Method

string filename =FileUpload.FileName;
string Fullpath = Path.Combine(@"D:\Media", filename);
if (FileUpload.HasFile)
  { 
 if (filename.ToLower().EndsWith("mp4"))
     {  
      //Saving the file
     }
  else
     {
          //I want to clear the  FileUpload content here
     }    
  }

解决方案

Clear the Attributes worked for me... but that will remove styles and other stuff

string filename =FileUpload.FileName;
string Fullpath = Path.Combine(@"D:\Media", filename);
if (FileUpload.HasFile)
{ 
  if (filename.ToLower().EndsWith("mp4"))
  {  
     //Saving the file
  }
  else
  {
     //I want to clear the  FileUpload content here
     FileUpload.Attributes.Clear();
  }    
}

这篇关于如何清除在服务器端的文件上传文本(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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