Hi I have the folloeing code and I am trying to save the image to 2 different locations. one locally and one on a network share accross a vpn, I have checked permissions and they seem to be fine, I have also tried a seperate stream after reading another thread but I am always getting the same error. I also tried setting up a virtual directory in IIS and then using serv.mappath, but it always returned a local path rather than the network share!!
Some help would be appreciated.
<code>
string strFilePath = Server.MapPath(Request.ApplicationPath + "/images/client/" + strClientLastNameLetter + "/");
string str2ndPath = @"\\192.168.0.252\ssnet\images\client\" + strClientLastNameLetter + @"\";
HttpFileCollection HttpFiles = Request.Files;
ArrayList aryPhoto = Photo.GetPhotoByClient(intClientID);
int j = aryPhoto.Count;
for (int i = 0; i < HttpFiles.Count; i++)
{
HttpPostedFile imgCurrentFile = HttpFiles
;
try
{
if (imgCurrentFile.ContentLength > 0)
{
string strPath = strFilePath + objClient.ID + "_" + (j + 1) + "_temp.jpg";
imgCurrentFile.SaveAs(strPath);
Photo objPhoto =
new Photo();
objPhoto.ClientID = intClientID;
objPhoto.Face = 0;
objPhoto.Date = dtePhotoDate;
objPhoto.Name = objClient.ID + "_" + (j + 1);
objPhoto.Notes = "";
objPhoto.OperatorID = intOperatorID;
int intPhotoID = objPhoto.Update();
System.Drawing.Image objImage = System.Drawing.Image.FromFile(strPath);
string[] strDecimal;
char chrDecimal = char.Parse(".");
double dblHeight = double.Parse(objImage.Height.ToString());
double dblWidth = double.Parse(objImage.Width.ToString());
double dblSmallRatio = dblWidth / 120;
double dblSmallHeight = dblHeight / dblSmallRatio;
string strSmallHeight = dblSmallHeight.ToString();
strDecimal = strSmallHeight.Split(chrDecimal);
strSmallHeight = strDecimal[0];
int intSmallHeight = Int32.Parse(strSmallHeight);
System.Drawing.Bitmap objBitmap =
new Bitmap(objImage, 120, intSmallHeight);
objBitmap.Save(strFilePath + objClient.ID + "_" + (j + 1) + "_TN.jpg", objImage.RawFormat);
objBitmap.Save(str2ndPath + objClient.ID + "_" + (j + 1) + "_TN.jpg", objImage.RawFormat); <-- error occurs here (a generic gdi+ error has occured
objImage.Dispose();
objBitmap.Dispose();
</code>