Forums
This topic is locked
aspsmartupload tutorial
Posted 18 Jan 2007 16:08:37
1
has voted
18 Jan 2007 16:08:37 Rob dalton posted:
ive been doing the aspsmartupload tutorial in dreamweaver i have 2 pages one the gathers the info and one that puts the images into a folder with the file path in the databaseodbc.asp
<!-- AspUpload Code samples: odbc.asp -->
<!-- Saving files in the database via ODBC -->
<!-- Copyright (c) 2001 Persits Software, Inc. -->
<!-- www.persits.com -->
<HTML>
<BODY BGCOLOR="#FFFFFF">
<h3> </h3>
<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="odbc_upload.asp">
<h3>Saving Files in the Database via ODBC<br>
<input name="image_main" type=FILE id="image_main" size="30">
</h3>
<h3>
<input name="image_small" type="file" id="image_small" size="30">
</h3>
<h3><br>
<input name="image_thumb" type="file" id="image_thumb" size="30">
<br>
<input type=SUBMIT value="Upload!">
</h3>
</FORM>
<P>
If you get the error <I><FONT COLOR="#FF0000">[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query</FONT></I>,
adjust permissions on the file <B>\Samples\04_db\aspupload.mdb</B> with Windows Explorer.
</BODY>
</HTML>
odbc_upload.asp
<%@LANGUAGE="VBSCRIPT"%><!-- AspUpload Code samples: odbc_upload.asp -->
<!-- Invoked by odbc.asp -->
<!-- Copyright (c) 2001 Persits Software, Inc. -->
<!-- www.persits.com -->
<HTML>
<BODY>
<%
Set Upload = Server.CreateObject("Persits.Upload"
' Capture files
Upload.Save "C:\Documents and Settings\Robert Dalton\Desktop\website\starsearchentertainment.com\images\musicians"
' Obtain file object
Set File = Upload.Files(image_main, image_small, image_thumb)
If Not File Is Nothing Then
' Build ODBC connection string
Connect = "Driver=SQL Server;Server=win10.cmmwebhosting.com;Database=starsearch.mdb;UID=robdalto;PWD=starry456"
' If you use SQL Server, the connecton string must look something like this:
' Connect = "Driver=SQL Server;Server=MYSRV;Database=starsearch.mdb;UID=robdalton;PWD=starry456"
' Build SQL INSERT statement
SQL = "INSERT INTO Artisttable(image_main, image_small, image_thumb) VALUES(?, '"
SQL = SQL & File.Filename & "', '"
SQL = SQL & Replace(Upload.Form("formup", "'", "''" & "', "
SQL = SQL & File.Size & ""
' Save to database
File.ToDatabase Connect, SQL
Response.Write "File saved."
Else
Response.Write "File not selected."
End If
%>
</BODY>
</HTML>
if anyone can help please do.