473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

File Does Not Exist

i have very strange problem in a Directory C:\Images I'm checking if an image
is exist then copy it to other folder using following code:
if(FilePath.Trim().Length == 0)
return String.Empty;
string fileName = System.IO.Path.GetFileName(FilePath);
string path = Server.MapPath("images\\LogInPageImages") + "\\" + fileName;
if(System.IO.File.Exists(FilePath))
//here Exist return false though file exist in folder ...WHY?
System.IO.File.Copy(FilePath,path,true);
return @"images\LogInPageImages\" + fileName ;

Nov 19 '05 #1
2 2102
get the value of the path and compare... just to be sure.
Also, if the user that IIS/ASP.Net is running under doesnt have permission
you will get a FALSE return.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Raed Sawalha" wrote:
i have very strange problem in a Directory C:\Images I'm checking if an image
is exist then copy it to other folder using following code:
if(FilePath.Trim().Length == 0)
return String.Empty;
string fileName = System.IO.Path.GetFileName(FilePath);
string path = Server.MapPath("images\\LogInPageImages") + "\\" + fileName;
if(System.IO.File.Exists(FilePath))
//here Exist return false though file exist in folder ...WHY?
System.IO.File.Copy(FilePath,path,true);
return @"images\LogInPageImages\" + fileName ;

Nov 19 '05 #2
This--> Server.MapPath("images\\LogInPageImages")
Should be -->Server.MapPath("images/LogInPageImages")

Note: in virtue path, you use "/", not "\" ("\\" in C#).

"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:B5**********************************@microsof t.com...
i have very strange problem in a Directory C:\Images I'm checking if an
image
is exist then copy it to other folder using following code:
if(FilePath.Trim().Length == 0)
return String.Empty;
string fileName = System.IO.Path.GetFileName(FilePath);
string path = Server.MapPath("images\\LogInPageImages") + "\\" + fileName;
if(System.IO.File.Exists(FilePath))
//here Exist return false though file exist in folder ...WHY?
System.IO.File.Copy(FilePath,path,true);
return @"images\LogInPageImages\" + fileName ;

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
4
by: cfyam | last post by:
How can I check some file is exist or not in my evc dll?
0
by: netjanuszk7 | last post by:
In SQL Server 2000 I have created a linked server. It was to link me with an Excel file. I received a message: I know about system.mdw, but it is linked with Access. And what about Excel. ...
1
by: TrailBlazer | last post by:
Hi - Been struggling over this issue for a long while. We store PDF's in our SQL Server database. And I do a BinaryWrite to display the PDF. It works for me without issue, on FireFox, IE, and...
3
by: OdAwG | last post by:
Hello All, I would i check to see if a file exist and if it does exist, then rename the file with the date and time attached to the name: Example: If...
1
by: prabhunew2005 | last post by:
Hi I am doing web portal design using PHP. The system has linux os. When i am moving to any of screens, the following error message is written into error log file. File does not exist:...
1
by: Lloyd Dupont | last post by:
I think you could test that for your self, couldn't you! ;-) VS is a good hexa editor, if you want to do some hexa read of your file... "DR" <softwareengineer98037@yahoo.comwrote in message...
23
by: canabatz | last post by:
can someone please help me set up a loop to wait for a file to be exist? i got a automation program that download a file from my ftp ,proccessing the file and returning back the result as a...
11
by: Abhilash Etikala | last post by:
File does not exist: C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/favicon.ico why i am getting this error??
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.