Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

IIS 6 and ASPUpload problem

Posted on 2004-04-14
8
Medium Priority
?
569 Views
Last Modified: 2007-12-19
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
Comment
Question by:radleydp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 34

Accepted Solution

by:
Big Monty earned 1000 total points
ID: 10826815
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
 

Author Comment

by:radleydp
ID: 10826889
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
 
LVL 34

Expert Comment

by:Big Monty
ID: 10826924
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:radleydp
ID: 10826974
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
 
LVL 34

Expert Comment

by:Big Monty
ID: 10826987
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
 
LVL 34

Expert Comment

by:Big Monty
ID: 10827003
sorry, i meant to say:
you're only returning the folder where i presume the FILE exists....

loooong daaaay here :)

B.D.
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 10827006
you also need to get ris of the rightmost slash on the path to the folder
0
 

Author Comment

by:radleydp
ID: 10827038
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

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question