
public static int FileSize;
const string UpFilePath="Fujian";
protected string FileName;
protected string FileType;
protected string FilePath;
string Mapname=null;
string [] up =this.input_Annex_Name.PostedFile.FileName.Split(new char []{'\\'});
string p=MapPath("")+"\\"+UpFilePath+"\\"+up[up.Length-1];
if(System.IO.File.Exists(p))
{
Websharp.WebUI.WebFunc.Alert("该文件已经存在!",Page);
}
else
{
string [] Date=DateTime.Now.ToString().Split(' ');
string [] name1= Date[0].Split('-');
string [] name2=Date[1].Split(':');
for(int i=0;i<3;i++)
{
Mapname+=name1[i]+name2[i];
}
Mapname=Mapname+up[up.Length-1];
string AccessoryUrl=Server.MapPath("..")+"\\FuJian\\"+Mapname;
this.input_Annex_Name.PostedFile.SaveAs(AccessoryUrl);
SingleTable st=new SingleTable("upload");
string title=this.input_Annex_Name.PostedFile.FileName.Substring(this.input_Annex_Name.PostedFile.FileName.LastIndexOf("\\")+1,this.input_Annex_Name.PostedFile.FileName.Length-this.input_Annex_Name.PostedFile.FileName.LastIndexOf("\\")-1);
string src=AccessoryUrl;
DateTime dt=Convert.ToDateTime(System.DateTime.Now.ToShortDateString());
object[] strValues ;
strValues = new object[]{title,src,dt};
st.GetData("insertupload",strValues);
Websharp.WebUI.WebFunc.Alert("上传成功!",Page);
}
}
catch
{
Websharp.WebUI.WebFunc.Alert("上传失败,请重新上传!",Page);
}

浙公网安备 33010602011771号