Hey
asp.net 2.0
The code below saves the "helloworld.jpeg" file to:
C:\Documents and Settings\Jeff\My Documents\Visual Studio
2005\WebSites\BN\webForms\Profile
HttpPostedFile file = fuPicture.PostedFile;
byte[] data = new byte[file.ContentLength];
file.InputStream.Read(data, 0, file.ContentLength);
Profile.Picture = data;
Profile.PictureType = file.ContentType;
//This is just a test:
System.IO.MemoryStream mstream = new System.IO.MemoryStream();
mstream.Write(data, 0, data.Length);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(mstream);
bmp.Save(Server.MapPath("helloworld.jpeg"),
System.Drawing.Imaging.ImageFormat.Jpeg);
mstream.Close();
\webForms is a subfolder in my project
\webForms\Profile is the folder which contains the form which execute the
code above....
This works but this isn't good solution because it gives the physical path
to the file on my devbox and I'm not sure I can use this on a live server...
How can I specify that for example the files generated should be saved to
"\image\" in my project folder (relative path)....??
I wonder because I want to save the path to the file in user's Profile and
are looking for the best way of specifying the path...
any suggestions?
Jeff