Forum Moderators: open

Message Too Old, No Replies

i am unable to use ASPUploadComponent

I am unable to use ASPUploadComponent

         

sunitha_mvd

10:53 am on Oct 21, 2003 (gmt 0)

10+ Year Member



Hi! Matt

I registered the ASPUploadComponent.dll in my domain server(say www.example.com.my) using regsver32 command,it prompted me that registered successfully.
But still i am not abe to use that component.What is just wrote is

<%
Option Explicit
Dim objUpload, strUploadPath, strMsg, strFileExtensions

'create the ActiveX object
Set objUpload = Server.CreateObject("ASPUploadComponent.cUpload")
Response.Write("object created")
%>

but it is not working out.can you pls tell me where i am going wrong.

thanks.
sunitha

[edited by: engine at 11:53 am (utc) on Oct. 21, 2003]

IanTurner

11:09 am on Oct 21, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Are you sure you have the name of the object correct in the Server.create object statement?

sunitha_mvd

11:51 am on Oct 21, 2003 (gmt 0)

10+ Year Member



yes,it is the same.still it is not working.

can you tell me where i am going wrong?

sunitha

IanTurner

1:05 pm on Oct 21, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I'm afraid that all looks fine to me.

When you got the component did it come with any test pages? can you get those to work?

The only thing I can think of is that the component hasn't registered properly.

DaveN

1:08 pm on Oct 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



rights on folders?

DaveN

pageoneresults

1:11 pm on Oct 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think DaveN might be on the right track. Last time I worked with the ASP Upload Component, I had to get my host to set permissions on the folder where the files were being uploaded.

mattglet

5:57 pm on Oct 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



i'm quite sure that the correct format is:

set objUpload = server.createobject("Persits.Upload.1")

in your previous post, that's what you had. why did you change it?

also, please post the error you are getting.

-Matt

IanTurner

12:14 am on Oct 22, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I assumed the error that was being generated was 'unable to Create object' which indicates that it is either the statement that is worng or that the .dll cant be found.

sunitha_mvd

6:02 am on Oct 22, 2003 (gmt 0)

10+ Year Member



Hi,Matt

Now i am able to register the component in our server and able to access it,but the problem i am getting is

i created two files
one is upload.asp file and another is uploadcomplete.asp file.

upload.asp file code is like this

<html>
<head>
<title>VB Web ASP File Upload</title>
</head>
<body>
<form action="uploadcomplete.asp" method="POST" enctype="multipart/form-data">
 <p>Please select a file to upload, and enter a description for it.</p>
 <p><b>File: </b><input type="file" style="width: 300;" name="thefile"><br>
 <b>Description:</b><br><textarea name="description" rows=4 cols=30></textarea></p>
 <input type="submit" value="Upload">
</form>
</body>
</html>

and uploadcomplete.asp is like this
<%
Option Explicit
Dim objUpload, strUploadPath, strMsg, strFileExtensions

'create the ActiveX object
Set objUpload = Server.CreateObject("ASPUploadComponent.cUpload")
'Response.Write("object created")

'set the upload path
strUploadPath = "http:\\www.example.com.my\"

'set the file extensions to exclude
strFileExtensions = ".exe;.dll"

If objUpload.FieldExists("thefile") = False Then
Response.Write "Invalid Post Data"
Response.End
Else
'file posted...
'attempt to save the file
On Error Resume Next
objUpload.Form("thefile").SaveFile strUploadPath, objUpload.Form("thefile").Value, strFileExtensions
If Err Then
'an error occured... ie file already exists, invalid extension etc
strMsg = "Error " & Err.Number & ": " & Err.Description
Else
'add description to the database?
'cConn.Execute ("INSERT INTO mydocs (FileName,Description) VALUES ('" & objUpload.Form("thefile").Value & "','" & objUpload.Form("description").Value
strMsg = "The file was successfully uploaded."
End If
End If
%>
<html>
<head>
<title>VB Web ASP File Upload Complete</title>
</head>
<body>
<p><%=strMsg%></p>
<p><b>File Name:</b> <%=objUpload.Form("thefile").Value%><br>
<b>File Size:</b> <%=objUpload.Form("thefile").FileSize%><br>
<b>Content Type:</b> <%=objUpload.Form("thefile").ContentType%><br>
<b>Description:</b> <%=objUpload.Form("description").Value%></p>
</body>
</html>

here i am trying to upload the any browsed file to our domain server(say www.example.com.my)

but i am getting the below error

Error -2147221400: The folder to upload to doesn't exist

File Name: md-training.txt
File Size: 2022
Content Type: text/plain
Description: file uploading for testing

could you pls help me where i am going wrong.
i am very greateful to you.

thanks and regards
sunitha.

[edited by: engine at 7:27 am (utc) on Oct. 22, 2003]
[edit reason] no specifics, thanks. See [url=http://www.webmasterworld.com/help.cgi?cat=tos]TOS[/ur [/edit]

sunitha_mvd

6:29 am on Oct 22, 2003 (gmt 0)

10+ Year Member



Hi,Matt

i think i am going wrong in mensioning the path

strUploadPath = "http:\\www.example.com.my\"

like this,i am i correct?if so,tell me correct path to mension.

thanks & regards,

sunitha

[edited by: engine at 7:28 am (utc) on Oct. 22, 2003]
[edit reason] No specifics, thanks. See [url=http://www.webmasterworld.com/help.cgi?cat=tos]TOS[/ur [/edit]

sunitha_mvd

8:19 am on Oct 22, 2003 (gmt 0)

10+ Year Member



hi!Matt
I got the solution.
thankyou for your guidence

sunitha_mvd

8:30 am on Oct 22, 2003 (gmt 0)

10+ Year Member



Hi,Matt

i have one small problem again.
i have 4 asp pages,in the second page i have upload file option,but this i need to upload after filling the other detail which are in my third page and 4 th page.
so,i need this file browsed path till my last page,so cont it be possible to take that parameter using
request.Form("filename") or request.QueryString("filename")?
I tried like this also
i have created the object of the aspupload component and then using that
obj.form("filename")
but still it is not working out.

could you pls give me a solution how it is possible?

thanks and regards
sunitha