Hey,
I need to save a file to the server. The standard file io code doen't work.
Please Help Me!
Printable View
Hey,
I need to save a file to the server. The standard file io code doen't work.
Please Help Me!
Sure it does. ;)
You need to grant permission to the folder you are trying to write 2.
can you post some example code
mine (even after perm.) wont work..got it to work with windows forms only :(
Here a code snippet I use on one of my pages to bind to a datalist control. I read in my image files from a directory within my web application:
NOTE: Saving works the same way
Code:private void LoadPostImages()
{
string dir = Server.MapPath(ActiveUser.PathToPostImages);
foreach (string img in Directory.GetFiles(dir, "*.gif")) {
rblPostImages.Items.Add(new ListItem("<img border=0 align=absmiddle src=" + dir + Path.GetFileName(img) + "> ", Path.GetFileName(img)));
}
rblPostImages.Items.Insert(rblPostImages.Items.Count, new ListItem("none", ""));
rblPostImages.SelectedIndex = rblPostImages.Items.Count - 1;
}