?
Solved

IIS 6 and ASPUpload problem

Posted on 2004-04-14
8
Medium Priority
?
563 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 33

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 33

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
Technology Partners: 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 33

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 33

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 33

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

Technology Partners: 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!

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 was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

771 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