Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 573
  • Last Modified:

IIS 6 and ASPUpload problem

Hi all,

I am updating my code since migrating to a Windows Server 2003 platform. I'm at the point now where I am able to send email and attach files.

However, attaching files isn't compulsory so the app trips up when no file is attached using this code:

objCDOSYSMail.AddAttachment ThisFile

Where ThisFile was dim'd earlier (if there is a file attached, it works perfectly).

So I tried this:

If Not ThisFile Is Nothing Then
objCDOSYSMail.AddAttachment ThisFile
End If

Which gives this error:

Microsoft VBScript runtime error '800a01a8'

Object required

/enroute/test/docnum/request_act.asp, line 123

Where am I going wrong?

TIA!
0
radleydp
Asked:
radleydp
  • 5
  • 3
1 Solution
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
if ThisFile is a string, just check the length of it, if its greater than one, then theres been a path assigned to it:
If Len(ThisFile) > 1 Then
    objCDOSYSMail.AddAttachment ThisFile
End If

hope this helps!
B.D.
0
 
radleydpAuthor Commented:
Almost works! If a file is attached, it attaches it and sends it no problem, now I get this error if no file is attached:

CDO.Message.1 error '80070005'

Access is denied.

/enroute/test/docnum/request_act.asp, line 124

(Line 124: objCDOSYSMail.AddAttachment ThisFile)
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
does ThisFile have a value if there is no attachment? you can do a response.write ThisFile to see if there is a value. if there is, then just do:
ThisFile = ""

B.D.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
radleydpAuthor Commented:
Here's the output from the response.write:

c:\inetpub\wwwroot\enroute\test\docnum\attachments/

So I changed If Len(ThisFile) > 1 Then to 51.

It's an ugly workaround, but I've only got a day left in this job, no time for anything better!

Thanks for the help :)
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
theres no file in the path, you're only returning the folder where i presume the path exists. you need to append the filename to the path.
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
sorry, i meant to say:
you're only returning the folder where i presume the FILE exists....

loooong daaaay here :)

B.D.
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
you also need to get ris of the rightmost slash on the path to the folder
0
 
radleydpAuthor Commented:
I would if I had the time. It's brutal looking code I'll admit, but it's doing its job now, I'll have to let my successor tidy it up.

It may be more secure, but switching to Server 2003 has pushed my patience a bit too far!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now