ASPUpload Form and Files

L

LCN

Hello, I have a form with multiple data elements and up to six files. On a
simple test I can get the files up to my computer! Great. Now I am trying
to get the form data to my database.

I have a .mdb defined and simply want to populate the fields.

I am very new at this so I am not sure exactly what to do.

This should be an easy one for someone. :) but it's killing me.
 
S

Stefan B Rusynko

The ASupload manual give you the instructions
See http://www.aspupload.com/manual_db.html

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


| Hello, I have a form with multiple data elements and up to six files. On a
| simple test I can get the files up to my computer! Great. Now I am trying
| to get the form data to my database.
|
| I have a .mdb defined and simply want to populate the fields.
|
| I am very new at this so I am not sure exactly what to do.
|
| This should be an easy one for someone. :) but it's killing me.
|
 
L

LCN

Yes, I have cut and pasted their code, however I am so new at this, and
frontpage adds a special twist with the DB Wizzard. I am doing something
wrong. I have defined a database via the database wizzard named
fpdb/aspupload.mdb with the correct data fields. I'm not sure of a few
things:

Is ODBC the correct connection method? they also give ADO examples
The file name "THEFILES" - i haven't defined this in frontpage anywhere is
it just taking the input from my input screen odbc.asp? It looks like they
have defined it in access as a file on the table.
Is the connection statement correct?
There are SQL Statements to insert to the SQL = "INSERT INTO MYIMAGES what
is MYIMAGES? I also haven't defined that anywhere in frontpage.

Sorry for the level of ineptness. Here are the two .asp ODBC.ASP and
ODBC_UPLOAD.ASP

I would greatly apprecitate any help.

ODBC.ASP
<HTML>
<BODY BGCOLOR="#FFFFFF">

<h3>Saving Files in the Database via ODBC</h3>

<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="odbc_upload.asp">
File:<BR><INPUT TYPE=FILE NAME="THEFILE"> <P>
Description:<BR><TEXTAREA NAME="DESCR"></TEXTAREA><BR>
<INPUT TYPE=SUBMIT VALUE="Upload!">
</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>

###### SECOND UPDATE ASP

ODBC_UPload.asp

<HTML>
<BODY>

<%
Set Upload = Server.CreateObject("Persits.Upload.1")

' Capture files
Upload.Save "c:\upload"

' Obtain file object
Set File = Upload.Files("THEFILE")

'If Not File Is Nothing Then
' Build ODBC connection string
Connect = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=URL=fpdb/aspupload.mdb"

' If you use SQL Server, the connecton string must look something like this:
' Connect = "Driver=SQL Server;Server=MYSRV;Database=master;UID=sa;PWD=xxx"

' Build SQL INSERT statement
SQL = "INSERT INTO MYIMAGES(image_blob, filename, description, filesize)
VALUES(?, '"
SQL = SQL & File.Filename & "', '"
SQL = SQL & Replace(Upload.Form("DESCR"), "'", "''") & "', "
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>


Stefan B Rusynko said:
The ASupload manual give you the instructions
See http://www.aspupload.com/manual_db.html

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


| Hello, I have a form with multiple data elements and up to six files. On a
| simple test I can get the files up to my computer! Great. Now I am trying
| to get the form data to my database.
|
| I have a .mdb defined and simply want to populate the fields.
|
| I am very new at this so I am not sure exactly what to do.
|
| This should be an easy one for someone. :) but it's killing me.
|
 
P

p c

For connecting to Access (JET) DB, use JET OLEDB DSN-less connections.
You can find what it is if you google for "connection strings"

In the long run you, you may want to learn ASP and database management.
Your examples use what is referred to as Classic ASP which runs on MS
windows servers with IIS V4-6. (ASP.NET runs on IIS6)

You can find plenty of tutorials on the net. Read them and try out the
samples for the projects you are interested. Here's one of many tutorials.

http://www.manastungare.com/publications/asp/tutorial/

...PC
Yes, I have cut and pasted their code, however I am so new at this, and
frontpage adds a special twist with the DB Wizzard. I am doing something
wrong. I have defined a database via the database wizzard named
fpdb/aspupload.mdb with the correct data fields. I'm not sure of a few
things:

Is ODBC the correct connection method? they also give ADO examples
The file name "THEFILES" - i haven't defined this in frontpage anywhere is
it just taking the input from my input screen odbc.asp? It looks like they
have defined it in access as a file on the table.
Is the connection statement correct?
There are SQL Statements to insert to the SQL = "INSERT INTO MYIMAGES what
is MYIMAGES? I also haven't defined that anywhere in frontpage.

Sorry for the level of ineptness. Here are the two .asp ODBC.ASP and
ODBC_UPLOAD.ASP

I would greatly apprecitate any help.

ODBC.ASP
<HTML>
<BODY BGCOLOR="#FFFFFF">

<h3>Saving Files in the Database via ODBC</h3>

<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="odbc_upload.asp">
File:<BR><INPUT TYPE=FILE NAME="THEFILE"> <P>
Description:<BR><TEXTAREA NAME="DESCR"></TEXTAREA><BR>
<INPUT TYPE=SUBMIT VALUE="Upload!">
</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>

###### SECOND UPDATE ASP

ODBC_UPload.asp

<HTML>
<BODY>

<%
Set Upload = Server.CreateObject("Persits.Upload.1")

' Capture files
Upload.Save "c:\upload"

' Obtain file object
Set File = Upload.Files("THEFILE")

'If Not File Is Nothing Then
' Build ODBC connection string
Connect = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=URL=fpdb/aspupload.mdb"

' If you use SQL Server, the connecton string must look something like this:
' Connect = "Driver=SQL Server;Server=MYSRV;Database=master;UID=sa;PWD=xxx"

' Build SQL INSERT statement
SQL = "INSERT INTO MYIMAGES(image_blob, filename, description, filesize)
VALUES(?, '"
SQL = SQL & File.Filename & "', '"
SQL = SQL & Replace(Upload.Form("DESCR"), "'", "''") & "', "
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>


:

The ASupload manual give you the instructions
See http://www.aspupload.com/manual_db.html

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


| Hello, I have a form with multiple data elements and up to six files. On a
| simple test I can get the files up to my computer! Great. Now I am trying
| to get the form data to my database.
|
| I have a .mdb defined and simply want to populate the fields.
|
| I am very new at this so I am not sure exactly what to do.
|
| This should be an easy one for someone. :) but it's killing me.
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top