Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file upload, save file name to database

Status
Not open for further replies.

gavray

Programmer
Jul 17, 2000
65
0
0
GB
I'm hoping someone can get me out of the rut
I'm trying to save the file to my server and the actual file name to the database. Then I make a link and not have the problems of large blobs in my database.

get this error,

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'UserFileName'

/bodge1.asp, line 20

this is the asp

<%
Dim status, email, image, rs, cn, strsql, f1, newpath, cstring, UserFileName, up1

cstring = &quot;DSN=profile;&quot;


up1 = UserFileName
Set up1 = Server.Createobject(&quot;Persits.Upload.1&quot;)

f1 = Server.MapPath(&quot;_/private/images/&quot;)

newpath = f1 & up1.UserFileName

Set cn = Server.CreateObject (&quot;adodb.Connection&quot;)
cn.Open cstring
strSQL = &quot;UPDATE profile SET image = '&quot; & up1.UserFileName & &quot;' Where email&quot; & _
&quot;like '&quot; & email & &quot;'&quot;
cn.Execute(strSQL)
cn.Close
Set cn = Nothing

up1.SaveAs newpath

set up1 = Nothing
%>

</body>
 
- ASPSmartUpload has an excellent example of saving a file to the drive and then adding the info into a database. Check out their info and maybe that will help you with your needs.
 
Hi,
did you figure out a way to solve your problem? I mean, storing the uploaded file to the database ??
Thanks!

RR


 
First you need to save the file to where ever
eg: Upload.Save &quot;d:\inetpub\uploads&quot;

Then you can extract the file name
eg: strdoc_name = Upload.Files(1).ExtractFileName

You may want to move your file to somewhere public using the FileSystemObject.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top