AddPhoto.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class AddPhoto : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnUpload_Click(object sender, EventArgs e)
{
if (Request.Files.Count > 0)
{
HttpPostedFile file = Request.Files[0];
if (file.ContentLength < 10240000)
{
DBConn conn = new DBConn();
conn.Open();
int imgid = conn.AddPhoto(Title.Text, Comment.Text);
conn.Close();
string fname = String.Format("{0}.jpg", imgid);
if (fname != null)
{
fname = Server.MapPath(@"photos\" + fname);
file.SaveAs(fname);
}
Response.Redirect("Show.aspx?imgid=" + imgid);
}
else
{
Response.Redirect("list.apsx");
}
}
}
protected void btnList_Click(object sender, EventArgs e)
{
Response.Redirect("list.aspx");
}
}
web.config
</configSections>
<location path ="write.aspx">
<system.web>
<httpRuntime maxRequestLength ="102400"/>
</system.web>
</location>
<appSettings/>
<connectionStrings/>



최근 덧글