Link to home
Start Free TrialLog in
Avatar of Gemini532
Gemini532Flag for United States of America

asked on

Server.CreateObject Failed

I have 2 files .asp files, one called browse.asp and one called uploadBrowse.asp to browse and upload files.  But I'm getting an error in the "uploadBrowse.asp" file.

THIS IS THE ERROR: (IT COMES FROM THE "uploadBrowse.asp" FILE
AND FROM THIS LINE OF CODE:  Set Upload = Server.CreateObject("Persits.Upload"))

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/angie/uploadBrowse.asp, line 4

Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.


This is the code for the "browse.asp" file:
<HTML>
<BODY BGCOLOR="#FFFFFF">
   <FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="uploadBrowse.asp">
      File 1:<INPUT TYPE=FILE NAME="FILE1">
      Description 1:<INPUT TYPE=TEXT NAME="DESCR1"><BR>
      File 2:<INPUT TYPE=FILE NAME="FILE2">
      Description 2:<INPUT TYPE=TEXT NAME="DESCR2"><BR>
   <INPUT TYPE=SUBMIT VALUE="Upload!">
   </FORM>
</BODY>
</HTML>

This is the code for the "uploadBrowse.asp" file:
<HTML>
<BODY>
<%
Set Upload = Server.CreateObject("Persits.Upload")
Count = Upload.Save("c:\upload")
Response.Write Count & " file(s) uploaded to c:\upload"
%>
</BODY>
</HTML>


Can you help me?
Avatar of peh803
peh803
Flag of United States of America image

Hey there --

This means that you don't have the Persists.Upload object registered on your web server.

Do you have access to the applicable DLL?  That's what you need to resolve this issue.

Thanks,
Phil / peh803
Sorry -- the DLL should be called "aspupload.dll"...

Thanks,
Phil
This is a link to a script I use to see if my host(s) support components:
http://www.pensaworks.com/prg_com.asp

basically you just download the script, and upload it to the server, then run the page.  It will show you a huge list of components and whether or not they are installed.  You can also filter by certain things like upload, email, etc...

The issue at hand is (without, knowing your host) that the ASPUpload component is not installed on your server.  You should use the script from above and find out what Upload component(s) are installed, and then use code for one of them...

HTH
Avatar of Gemini532

ASKER

But what am I looking for?  What needs to be installed?

aspupload.dll

Where on my computer or on the server which runs the website that I'm programming?
It seems that there's a 30 day free trial, this is something one has to buy?
But for hte people who would like to upload attachements to their email and have an application send them,w hat can they do if they dont have money?
Is there any way to do this for free?
ASKER CERTIFIED SOLUTION
Avatar of peh803
peh803
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Wow!  I am very confused.  I downloaded the files, but I have no idea how I should use them...
I mean their code is so strange...  It might be too advanced for me...
Is this the simplest program there is?
Are you using the PseudoRequestDictionary now, which is what this question is about?
https://www.experts-exchange.com/questions/21904538/Displaying-data-in-columns-and-rows.html

If so, you could have just posted the issue in this question... Since you've opened another question, and since you appear to be using one of the recommended items in that link, you should probably close this question.

Thanks,
Phil
Ah -- you and I posted about the same time!  Okay -- so the code that is in the PseudoRequestObject isn't something that you should have to change.  Using the code is really quite simple.  I can help you with that if you like.  

What are you trying to accomplish?  I.e., do you want a form that allows users to upload 1 file from their PC to your server, and you also want to be able to write some fields to a DB?

Thanks,
Phil
Actually I want to add files as attachments to EMAILS.

I have the code where the user clicks and BROWSER button and adds the name of the file.  Then he needs to click the SUBMIT button and the attachment gets attached to his email....  My email is using JMAIL, if you want I can include the code I have so far...  

The only thing saved in the database is the NAME of the file, not the file itself, and I'm pretty sure that's just saving text with request.form("path")

MY brother said that the attachments I'm sending to the emails have to first be saved in a folder on the server, is this true?  He doesn't know that much about it...He can't help me code it...  
please see here for attachments with JMail:
http://www.webmage.com/support/jmail.asp#AddAttachment
I tried this code, but it didn't work  EVEN THOUGH there a file by this name in my c: drive       objMail.AttachFile("c:\images\form.txt")

 
<%
  Option Explicit
 
  Dim objMail
  Set objMail = Server.CreateObject("CDONTS.NewMail")
 
     objMail.From = "friend@somewhere.com"
     objMail.Subject = "A message TO you"
     objMail.AttachFile("c:\images\form.txt")
     objMail.To = "someone@someplace.com"
     objMail.Body = "This is the body of the Message"
     objMail.Send
 
 Response.write("Mail was Sent")
 
 'You must always do this with CDONTS.
  set objMail = nothing
%>


I get this error:


error '80004005'
Unspecified error

/investment/ProposalsReceived.asp, line 137


From this line:   objMail.AttachFile("c:\images\form.txt")
ok....now you are confusing everyone here.....first you said it was an upload problem, then you said it's a JMail problem, but then you go and post code for CDONTS.

Please, before you go any further, make up my mind, and tell me what the problem is.
This isn't working either:
JMail.AddAttachment( "c:\\angie/form.txt" )

Is this javascript?  I need VBScript...

OK I got it to work, but it ONLY WORKS WITH THIS VIRTUAL PATH (this is in JMail)
dim path

path = "/angie/readme.txt"
objMail.AddAttachment(Server.MapPath(path))

If I try to do this:

objMail.AddAttachment path, fileName

It no longer works, and I don't understand why!!!??!??
I mean after all I know the file exists there... why can't it attach it?
path = "c:/angie/readme.txt"       <-- if it's real path
theh problem is that the people who will upload the attachments to the form, will not use a virtual path.
They would get their files from their c drive or their desktop, so I need this to work
This is the error I get:

jmail.SMTPMail error '8000ffff
Cannot open file c:\temp\testdocument.doc email_process.asp, line 123
where line 123 is JMail.AddAttachment("c:\temp\testdocument.doc")


This is what the internet suggest, but I don't understand, because my users who fill out the form will not have virtual paths, so I cannot use this...

To find the location of the file on your webserver use the Server.MapPath command like this,
JMail.AddAttachment(Server.MapPath("/temp/testdocument.doc"))
It says:  The file must be local to the server.
so to make this file local to the server, is that why I need to use the Persists.Upload object ?!?
or the the PseudoRequestDictionar?
Is this what I need to use to th make the files local to the server and after that the users can attach them and the emails will be sent with their attachments?  How do I do this?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm using JMail, I tried to  use CDONTS, but it didn't work, so I'm using JMail now  :)

I'm getting this error:

jmail.SMTPMail error '8000ffff'

Cannot open file c:\angie\form.txt

/investment/ProposalsReceived.asp, line 197

The folder angie has "write" permissions...
ok, please post your whole code for ProposalsReceived.asp
<%
dim lName, fName, Comments, Attachment
dim DateSubmitted
dim strBody1

fName = Request.Form("FName")
lName = Request.Form("LName")
Comments = Request.Form("Comments")
DateSubmitted = Date()
Attachment = Request.Form("attach1")

'*********DATABASE CONNECTION************
dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "fake","fake","fake"
      
requestSQL = "INSERT into [Proposals] (FirstName, LastName, Comments, AttachedFiles, DateSubmitted) values ('" & _
replace(fName, "'", "''") & "', '" & replace(lName, "'", "''") & "', '" & replace(Comments, "'", "''") & "', '" & replace(Attachment, "'", "''") & "', '" & replace(DateSubmitted, "'", "''") & "')"

objConn.Execute requestSQL
objConn.Close
Set objConn = Nothing

'***Re-open Connection to Start Email Code**********
dim conect, CommentsId
Set conect = Server.CreateObject("ADODB.Connection")
conect.Open "fake","fake","fake"

'On Error Resume Next
sqlError = "select * from [Proposals] where [Proposals].[FirstName] = ('" & replace(fName, "'", "''") & "') and [Proposals].[LastName] = ('" & replace(lName, "'", "''") & "') and [Proposals].[Comments] LIKE ('" & replace(Comments, "'", "''") & "') "

Set rsErrorCheck = Server.CreateObject("ADODB.Recordset")
rsErrorCheck.Open sqlError, conect

'Long recordset counting using a simple loop by Barry Wright
Dim strCount
strCount = 0
While NOT rsErrorCheck.EOF AND NOT rsErrorCheck.BOF
      strCount = strCount + 1
      rsErrorCheck.MoveNext()
Wend

function sendEmail(body, Recipient1)
            'JMAIL CODE ADDED 7-19-2001 BY MICHAEL LABMAN TO REPLACE CDONTS
            set objMail=Server.CreateObject("Jmail.SMTPMail")
            if Err.number <> 0 then
                  Response.Write("<BR>Error Sending Mail <BR>")
            else
                  objMail.ServerAddress = "fake.fake.fake"
                  objMail.AddRecipient("blah@blah.blah")                        
                  objMail.Sender = "fake@fake.fake"
                  objMail.Subject="Proposals Request"
                  ‘objMail.AddAttachment( "C:\INETPUB\WWWROOT\angie\form.txt" )
                  'objMail.AddAttachment(Server.MapPath(Attachment))
                  objMail.AddAttachment(Attachment)            
                  objMail.Body=body      
                  objMail.Execute
            end if
            set objMail=nothing
end function      
dim Recipient1

if strCount > 0  then  
'********************
            dim emailBody
            dim strBody
            
            strBody= "Name: " & fName & " " & lName
            strBody=strBody & chr(10) & "Comments: " & Comments  
            strBody=strBody & chr(10) & "Date Submitted: " & DateSubmitted & vbCrLf
            emailBody=strBody
            sendEmail emailBody, Recipient1   'send email if the data was submitted correctly
else      ' (RecordCount = -1 means that ADO could not find any records)
            
dim noDataEBody
            noDataEBody =  "The form you submitted did not reach the database. “                  
            sendEmail noDataEBody, Recipient1  'call function, send email if the data did not make it to the database
end if

rsErrorCheck.close
set rsErrorCheck = nothing
conect.Close
Set conect = Nothing
%>
<center>Your proposal has been submitted!</center>
The "Attachment" variable from this line of code Attachment = Request.Form("attach1")
gets the path (C:\INETPUB\WWWROOT\angie\form.txt) for the file which needs to be attached to the email
This path is always differnet depending on what file the user wants to attach...

It comes from this BROWSE text box:  <INPUT TYPE="FILE" NAME="attach1" size = "35"> from  a file called "submit.asp"
Here is some of its code:

<FORM METHOD="POST"  ACTION="ProposalsReceived.asp" onSubmit="return validate(this)" id = "ProposalsForm" name = "ProposalsForm" ENCTYPE="multipart/form-data" >

First Name: <INPUT NAME="FName" VALUE="" size=30>
Last Name: <INPUT NAME="LName" VALUE="" size=30>
Comments: <TEXTAREA NAME="Comments" rows=15 cols=50 virtual=wrap></TEXTAREA>
Attach File:  <INPUT TYPE="FILE" NAME="attach1" size = "35">

<INPUT type="submit" value="Upload" name="submit" style = "background:#0D6B9C; font-weight:bold; color:#FFFFFF;">
</FORM>
please see your other post.

you will need to modify your email function, as with the way you have it now, will go to no-one.
Actually this code works, but only when I attach a file from my webserver, not from my desktop and I use this code:
'objMail.AddAttachment(Server.MapPath(Attachment))

I am trying to get it to work, when I attach a file from my desktop...
As I understand it the idea is to upload the desktop file on my web server and then it will work...  Please let me know if I am wrong about this...