Skip to main content
Known Participant
January 20, 2007
Question

spare 10 mins 2 help with aspsmartupload

  • January 20, 2007
  • 1 reply
  • 254 views
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 database

odbc.asp

<!-- AspUpload Code samples: odbc.asp -->
<!-- Saving files in the database via ODBC -->
<!-- Copyright (c) 2001 Persits Software, Inc. -->
<!-- http://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. -->
<!-- http://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.
This topic has been closed for replies.

1 reply

Inspiring
January 20, 2007
It seems like the error message is giving you instructions on what to do.
ie. adjust the permissions on the database file. Should be IUSR for browser
access. More info on my site

http://www.charon.co.uk/content.aspx?CategoryID=27&ArticleID=56

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004