Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 24, 2009 06:39 AM by sarang2511
Feb 24, 2009 04:47 AM|LINK
I have hosted my website on godaddy.com. THey have a limitation on the size of db. So i cannot load all the photos i have into the db. I wanted to store the photo into the file system and store the path into the database. At this point I still m not sure
why were photos required to be stored into the db. as this has some catastrophic performance issus on my website. I am lookig for some samples to see if somebody has already changed the code to store the name of he tfile rather tha the image bytes itself.
Many thanks in Advance,
Feb 24, 2009 06:39 AM|LINK
I have done what you are asking for.
you need a file upload control and this uploadcatimage will return the path where the image is.
private string UploadCatImage()
string filepath = string.Empty;
string savepath = string.Empty;
string virtualfolder = string.Empty;
filepath = Server.MapPath("./") + "Category";
if (FileUpload1.PostedFile.ContentLength != 0)
string filename = string.Empty;
string str = tbuname.Text.ToString();
filename = str + "." + GetExtension(FileUpload1.PostedFile.FileName);;
savepath = "Category/" + filename;
FileUpload1.PostedFile.SaveAs(filepath + "/" + filename);
savepath = "Category/blankimg.jpeg";
private string GetExtension(string FileName)
string split = FileName.Split('.');
string Extension = split[split.Length - 1];