C〓〓〓は、フォルダが存在するかどうかを判断してフォルダを作成する方法を実現します。
この実例は、フォルダの存在を判断してフォルダを作成する方法を説明する。皆さんに参考にしてあげます。具体的には以下の通りです。
ここで述べたように、皆さんのC〓プログラムの設計に役に立ちます。
protected void Button1_Click(object sender, EventArgs e)
{
if (Directory.Exists(Server.MapPath("~/upimg/hufu")) == false)// file
{
Directory.CreateDirectory(Server.MapPath("~/upimg/hufu"));
}
//Directory.Delete(Server.MapPath("~/upimg/hufu"), true);// ,
//
if (File.Exists(Server.MapPath("~/upimg/Data.html")))
{
Response.Write("Yes");
//
}
else
{
Response.Write("No");
//
File.Create(MapPath("~/upimg/Data.html"));//
}
string name = GetFiles.FileName;//
string size = GetFiles.PostedFile.ContentLength.ToString();//
string type = GetFiles.PostedFile.ContentType;// MIME
string postfix = name.Substring(name.LastIndexOf(".") + 1);//
string ipath = Server.MapPath("upimg") +"\\"+ name;//
string fpath = Server.MapPath("upfile") + "\\" + name;
string dpath = "upimg\\" + name;//
ShowPic.Visible = true;//
ShowText.Visible = true;//
//
if (name == "") {
Response.Write("<script>alert(' ')</script>");
}
else{
if (postfix == "jpg" || postfix == "gif" || postfix == "bmp" || postfix == "png")
{
GetFiles.SaveAs(ipath);
ShowPic.ImageUrl = dpath;
ShowText.Text = " :" + name + "<br>" + " :" + size + "KB" + "<br>" + " :" + type + "<br>" + " :" + ipath;
}
else
{
ShowPic.Visible = false;//
GetFiles.SaveAs(fpath);// , upfile
ShowText.Text = " :" + name + "<br>" + " :" + size + "KB" + "<br>" + " :" + type + "<br>" + " :" + fpath;
}
}
}
C関連の内容についてもっと興味がある読者は、本局のテーマを見ることができます。「C〓〓文書の操作常用技巧のまとめ」、「C〓〓は計算方法と技巧を遍歴して総括します。」、「C〓〓〓プログラムの設計のスレッドは技巧を使って総括します。」、「C葃操作Excel技術まとめ」、「C〓中XMLファイルの操作技術のまとめ」、「C〓〓よくあるコントロールの使い方教程」、「WinFormコントロールの使い方のまとめ」、「C〓〓〓データ構造とアルゴリズム教程」、および「Cハハハハ配列操作技術のまとめ」ここで述べたように、皆さんのC〓プログラムの設計に役に立ちます。