📄 up_loadcs.cs
字号:
using System;
using System.IO;
namespace Sp
{
/// <summary>
/// Up_Loadcs 的摘要说明。
/// </summary>
public class Up_Loadcs
{
public string[] Resup={"上传失败或指定的文件不存在","图片大于10K,重新传图片!","格式不对,限制上传(只允许gif/jpg格式文件)!","上传成功!"};
public string s = string.Empty;
public string Up(System.Web.UI.HtmlControls.HtmlInputFile File2,string Pa)
{
//
// TODO: 在此处添加构造函数逻辑
//
if (File2.PostedFile.ContentLength.ToString() == "0")
{
return "0";
}
else
{
//获取文件名称
string ss ;
ss =System.DateTime.Now.ToString().Replace("-","").Replace(" ","").Replace(":","")+Path.GetExtension(File2.PostedFile.FileName);
if (File2.PostedFile.ContentLength/1024>10)
{return "1";}
else
{
string ty=File2.PostedFile.ContentType;
if (ty=="image/gif"||ty=="image/pjpeg")
{
File2.PostedFile.SaveAs(System.Web.HttpContext.Current.Server.MapPath(Pa) + ss);
s= ss;
return "3";
//Up= ss;
}
else
{return "2";}
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -