Solved

IIS 6 and ASPUpload problem

Posted on 2004-04-14
8
548 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
  • 5
  • 3
8 Comments
 
LVL 32

Accepted Solution

by:
Big Monty earned 250 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 32

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
 

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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 32

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 32

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 32

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now