Hello everyone,
I am having a problem. I have a program that allows users to upload a zip file and then unzip it. On the unzip function it does a line entry into the database about the size and shape of the jpgs and then unzips the folders and places them in a directory. the problem is that i get the filenotfoundexception even though the file is there. I'd appreciate any help or ideas thanks.
private void InsertZip(string DBCreativeName, string DBActive, int DBDesignerID, UploadedFile infile)
{
string[] directoryEntries =
System.IO.Directory.GetFileSystemEntries(Server.MapPath(@"DataImages\\" + infile.GetNameWithoutExtension()));
foreach (string str in directoryEntries)
{
string ZipSize = "";
string ZipSourcePath = Server.MapPath(@"DataImages\\ZipFolder\\" + infile.GetNameWithoutExtension() + "\\");
ZipSourcePath += Path.GetFileName(str);
// string ZipDestPath = Server.MapPath(@"DataImages\\");
//ZipDestPath += Path.GetFileName(str);
string ZipEntryPhysicalName = Path.GetFileName(str);
System.Drawing.Image objImage = System.Drawing.Image.FromFile(str);
string ZipEntryWidth = objImage.Width.ToString();
string ZipEntryHeight = objImage.Height.ToString();
string ZipCreativeName = DBCreativeName;
//string ZipKeys = DBKeys;
string ZipActive = DBActive;
int ZipDesignerID = DBDesignerID;
Error happens on this line:
System.Drawing.Image objImage = System.Drawing.Image.FromFile(str);
the str variable is the culprit but I don't know why. Permissions are fine and files and directories exist
this is the error from my application log
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 1/23/2009 10:50:29 AM
Event time (UTC): 1/23/2009 3:50:29 PM
Event ID: 50f7dec7a3c9485a93f6de35d6cb104f
Event sequence: 13
Event occurrence: 2
Event detail code: 0
Application information:
Application domain: /LM/w3svc/1/ROOT/Creative35-8-128771978828860680
Trust level: Full
Application Virtual Path: /Creative35
Application Path: C:\Creative35\Trunk\src\Creative35\
Machine name: TONI
Process information:
Process ID: 3152
Process name: aspnet_wp.exe
Account name: TONI\ASPNET
Exception information:
Exception type: FileNotFoundException
Exception message: C:\Creative35\Trunk\src\Creative35\DataImages\flo\flo
Request information:
Request URL:localhost/Creative35/TelerikTab.aspx
Request path: /Creative35/TelerikTab.aspx
User host address: 127.0.0.1
User:
Is authenticated: False
Authentication Type:
Thread account name: TONI\ASPNET
Thread information:
Thread ID: 1
Thread account name: TONI\ASPNET
Is impersonating: False
Stack trace: at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
at System.Drawing.Image.FromFile(String filename)
at Creative35.TelerikTab.InsertZip(String DBCreativeName, String DBActive, Int32 DBDesignerID, UploadedFile infile) in C:\Creative35\Trunk\src\Creative35\TelerikTab.aspx.cs:line 881
at Creative35.TelerikTab.btnimageupload_Click(Object sender, EventArgs e) in C:\Creative35\Trunk\src\Creative35\TelerikTab.aspx.cs:line 611
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Any help would be appreciated,
Yusef
I am having a problem. I have a program that allows users to upload a zip file and then unzip it. On the unzip function it does a line entry into the database about the size and shape of the jpgs and then unzips the folders and places them in a directory. the problem is that i get the filenotfoundexception even though the file is there. I'd appreciate any help or ideas thanks.
private void InsertZip(string DBCreativeName, string DBActive, int DBDesignerID, UploadedFile infile)
{
string[] directoryEntries =
System.IO.Directory.GetFileSystemEntries(Server.MapPath(@"DataImages\\" + infile.GetNameWithoutExtension()));
foreach (string str in directoryEntries)
{
string ZipSize = "";
string ZipSourcePath = Server.MapPath(@"DataImages\\ZipFolder\\" + infile.GetNameWithoutExtension() + "\\");
ZipSourcePath += Path.GetFileName(str);
// string ZipDestPath = Server.MapPath(@"DataImages\\");
//ZipDestPath += Path.GetFileName(str);
string ZipEntryPhysicalName = Path.GetFileName(str);
System.Drawing.Image objImage = System.Drawing.Image.FromFile(str);
string ZipEntryWidth = objImage.Width.ToString();
string ZipEntryHeight = objImage.Height.ToString();
string ZipCreativeName = DBCreativeName;
//string ZipKeys = DBKeys;
string ZipActive = DBActive;
int ZipDesignerID = DBDesignerID;
Error happens on this line:
System.Drawing.Image objImage = System.Drawing.Image.FromFile(str);
the str variable is the culprit but I don't know why. Permissions are fine and files and directories exist
this is the error from my application log
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 1/23/2009 10:50:29 AM
Event time (UTC): 1/23/2009 3:50:29 PM
Event ID: 50f7dec7a3c9485a93f6de35d6cb104f
Event sequence: 13
Event occurrence: 2
Event detail code: 0
Application information:
Application domain: /LM/w3svc/1/ROOT/Creative35-8-128771978828860680
Trust level: Full
Application Virtual Path: /Creative35
Application Path: C:\Creative35\Trunk\src\Creative35\
Machine name: TONI
Process information:
Process ID: 3152
Process name: aspnet_wp.exe
Account name: TONI\ASPNET
Exception information:
Exception type: FileNotFoundException
Exception message: C:\Creative35\Trunk\src\Creative35\DataImages\flo\flo
Request information:
Request URL:localhost/Creative35/TelerikTab.aspx
Request path: /Creative35/TelerikTab.aspx
User host address: 127.0.0.1
User:
Is authenticated: False
Authentication Type:
Thread account name: TONI\ASPNET
Thread information:
Thread ID: 1
Thread account name: TONI\ASPNET
Is impersonating: False
Stack trace: at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
at System.Drawing.Image.FromFile(String filename)
at Creative35.TelerikTab.InsertZip(String DBCreativeName, String DBActive, Int32 DBDesignerID, UploadedFile infile) in C:\Creative35\Trunk\src\Creative35\TelerikTab.aspx.cs:line 881
at Creative35.TelerikTab.btnimageupload_Click(Object sender, EventArgs e) in C:\Creative35\Trunk\src\Creative35\TelerikTab.aspx.cs:line 611
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Any help would be appreciated,
Yusef