473,395 Members | 1,689 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,395 software developers and data experts.

File.Exist(RecentelyCreatedPDFUsingPdfCreator_File Path) returns false

I m working on a Sending mail functionality. In that I first create a pdf and then attach that PDF to the mail and send to the use.

Problem
1) is when I check for
Expand|Select|Wrap|Line Numbers
  1. strPDFFile= Server.MapPath("~/HTMLReportSource/PDFSchedules/" & "ABC.pdf")
  2. If File.Exists(strPDFFile) Then
  3.                 strAttachmentPath = "~/HTMLReportSource/PDFSchedules/" & ViewState("VS2005_GENERATED_POLICY_NO") & ".pdf"
  4.  
  5.             Else
  6.                 strAttachmentPath = ""
  7. end if
  8.  
I get value as false even though I can see the file.
2) even If i give the path of the pdf file using
Expand|Select|Wrap|Line Numbers
  1. attach = New Attachment(System.Web.HttpContext.Current.Server.MapPath(strAttachmentPath))
  2.                         smail.Attachments.Add(attach )
I get exception.


I m not sure why this happening as if I send PDFFileNamePath with previously created file, it works fine.
But issue is with the recently created file.

Please help me on this issue as I have already wasted lot of time on this.
thanks in advance.
May 16 '13 #1

✓ answered by Frinavale

On line 1 you have:
Expand|Select|Wrap|Line Numbers
  1. strPDFFile= Server.MapPath("~/HTMLReportSource/PDFSchedules/" & "ABC.pdf")
Are you sure you are supposed to be checking if "ABC.pdf" exists?

Or are you supposed to be looking to see if ViewState("VS2005_GENERATED_POLICY_NO") & ".pdf" exists?

-Frinny

3 1556
Frinavale
9,735 Expert Mod 8TB
Use the debugger and check the value of the strPDFFile variable at runtime.

Make sure it is the path that you are expecting it to be.

-Frinny
May 28 '13 #2
Path is as expected and i can see the file also but still i am not able to find the file in File.Exists().
Jun 4 '13 #3
Frinavale
9,735 Expert Mod 8TB
On line 1 you have:
Expand|Select|Wrap|Line Numbers
  1. strPDFFile= Server.MapPath("~/HTMLReportSource/PDFSchedules/" & "ABC.pdf")
Are you sure you are supposed to be checking if "ABC.pdf" exists?

Or are you supposed to be looking to see if ViewState("VS2005_GENERATED_POLICY_NO") & ".pdf" exists?

-Frinny
Jun 4 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Martin Lucas-Smith | last post by:
I wrote the function below as part of a larger class. The fopen stage works, and, as according to the documentation at www.php.net/fopen that succesfully creates a new file. The fwrite stage...
3
by: annie | last post by:
Hi I've got two linux boxes running redhat9 and either PHP Version 4.2.2 or PHP Version 4.3.7. The file structure is set up the same on both machines and both files exist. The problem is not...
5
by: lkrubner | last post by:
www.php.net says: >>>>>>>>>>>> Only for SELECT,SHOW,EXPLAIN or DESCRIBE statements mysql_query() returns a resource identifier or FALSE if the query was not executed correctly. For other type of...
4
by: Sacha Korell | last post by:
First of all, sorry for cross-posting, but this newsgroup is much busier than "aspnet.mobile". I'm trying to create a portal page that redirects depending on the device that is connecting. ...
6
by: Kimmo Laine | last post by:
Running IIS 6 on Windows 2003 server. After an update to the most recent version of php 5.1.2, for some reacon a function handling uploaded files using is_file stopped working. is_file failed...
3
by: peter | last post by:
I have a weird problem in some code I am writing. The user selects a number of files from a list and then can select an option which will rename the selected files. Before the process starts, a...
4
by: Italian Pete | last post by:
Hi, I have a website sitting on a server (ServerA) with images to be displayed sitting on a separate server (ServerB) on the same network. I am trying to test for the existance of an image...
12
by: snow | last post by:
Hi All, I noticed if file path has a white space, for example "C:\my document \test.txt", the function File.Exists(filePath) always return false in release mode. How could I make this function...
1
by: Samuel R. Neff | last post by:
I have a file in a directory that is returned from Directory.GetFiles() but subsequently fails a File.Exists() check. Test code: string p = @"C:\documents and settings\all users\" +...
5
dmjpro
by: dmjpro | last post by:
File l_file = new File(path); System.out.println(l_file.exists()); //returns true System.out.println(l_file.delete()); //returns false How does this happen? Could anyone explain?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.