Solved

IIS 6 and ASPUpload problem

Posted on 2004-04-14
8
550 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
if form parameter is null redirect 2 53
SP to delete duplicates 15 60
Select distinct 25 81
Need help editing script 3 65
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 information …
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 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