Hi,
I want to save images in a default directory , can be project setup directory.
Thanks in Advance,
A.Durga Prasad
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
durga prasadPosted Jan 27, 2009, 2:25 AM
I was asking this one for Windows Application and not for web application,anyhow I got the answer , for others who may be intrested can see this.
Adding Image
string image_outputDir = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
DirectoryInfo df = new DirectoryInfo(image_outputDir + @"\images\" + dbfTxtImageName.Text);
dbfTxtImageURL.Text = df.ToString();
Saving the image in application directory
string image_outputDir = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
DirectoryInfo df = new DirectoryInfo(image_outputDir + @"\images\" + dbfTxtImageName.Text);
String paths;
paths = df.ToString();
txtimages.Image.Save(paths,System.Drawing.Imaging.ImageFormat.Jpeg);
MessageBox.Show("Image Saved succesfully");
Displaying the image, after saving the image url in the database
txtimages.Image =Image.FromFile(Path,true);
Kaustubh MhadgutPosted Jan 22, 2009, 5:57 AM
Hi,
Use the FileUpload control.
<
asp:FileUpload runat="server" id="FileUpload1" />Then on a button click.
FileUpload1.PostedFile.SaveAs(Server.MapPath(
"~/image/") + "filenamewith extension"You can specify whatever path you want.