Hello,
I can upload files using asp, but when I try and store the location and filename into a database it created a new row but there is no info. there.
I think it is to do with ENCTYPE="multipart/form-data" is used when uploading. because when I remove this line the data is entered into the database but the file isn't uploaded.
Is there a way I can ENCRYPT the file after the location and name has been saved ?
at present i Do the encryption when I post the data.
This is the first page where I choose the Filename and name:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="uploadexmple.asp">
<TABLE BORDER=0>
<tr><td><b>Enter your fullname:</b><br><INPUT TYPE=TEXT SIZE=40 NAME="FULLNAME"></td></tr>
<tr><td><b>Select a file to upload:</b><br><INPUT TYPE=FILE SIZE=50 NAME="FILE1"></td></tr>
<tr><td><b>Save To:</b>
Disk <INPUT TYPE=RADIO NAME="saveto" value="disk" checked>
Database <INPUT TYPE=RADIO NAME="saveto" value="database">
</td></tr>
<tr><td align="center"><INPUT TYPE=SUBMIT VALUE="Upload"></td></tr>
</TABLE>
</FORM>
</BODY>
</HTML>
I am using the following code to insert the location and name into the db :
<%
'Declare all local variables
dim conn
dim strSQL
strsql = ""
'set connection string to local variable-I use a DSN-less connection
If IsObject(Session("EDNoticeBoard_conn"
) Then
Set conn = Session("EDNoticeBoard_conn"
Else
Set conn = Server.CreateObject("ADODB.Connection"
conn.open "EdNoticeBoard","Ednoticeboard","ednoticeboard"
Set Session("EdNoticeBoard_conn"
= conn
End If
%>
<%
'build the sql statement based on the input from the form
strSQL = "INSERT INTO tblphotos(name, photo)"
strSQL = strSQL & " SELECT "
strSQL = strSQL & "'" & Request("FULLNAME"
& "' as name,"
strSQL = strSQL & "'" & Request("FILE1"
& "' as photo"
conn.execute(strSQL)
conn.close
set conn = nothing
%>
thank you in advance
Jamie
I can upload files using asp, but when I try and store the location and filename into a database it created a new row but there is no info. there.
I think it is to do with ENCTYPE="multipart/form-data" is used when uploading. because when I remove this line the data is entered into the database but the file isn't uploaded.
Is there a way I can ENCRYPT the file after the location and name has been saved ?
at present i Do the encryption when I post the data.
This is the first page where I choose the Filename and name:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="uploadexmple.asp">
<TABLE BORDER=0>
<tr><td><b>Enter your fullname:</b><br><INPUT TYPE=TEXT SIZE=40 NAME="FULLNAME"></td></tr>
<tr><td><b>Select a file to upload:</b><br><INPUT TYPE=FILE SIZE=50 NAME="FILE1"></td></tr>
<tr><td><b>Save To:</b>
Disk <INPUT TYPE=RADIO NAME="saveto" value="disk" checked>
Database <INPUT TYPE=RADIO NAME="saveto" value="database">
</td></tr>
<tr><td align="center"><INPUT TYPE=SUBMIT VALUE="Upload"></td></tr>
</TABLE>
</FORM>
</BODY>
</HTML>
I am using the following code to insert the location and name into the db :
<%
'Declare all local variables
dim conn
dim strSQL
strsql = ""
'set connection string to local variable-I use a DSN-less connection
If IsObject(Session("EDNoticeBoard_conn"
Set conn = Session("EDNoticeBoard_conn"
Else
Set conn = Server.CreateObject("ADODB.Connection"
conn.open "EdNoticeBoard","Ednoticeboard","ednoticeboard"
Set Session("EdNoticeBoard_conn"
End If
%>
<%
'build the sql statement based on the input from the form
strSQL = "INSERT INTO tblphotos(name, photo)"
strSQL = strSQL & " SELECT "
strSQL = strSQL & "'" & Request("FULLNAME"
strSQL = strSQL & "'" & Request("FILE1"
conn.execute(strSQL)
conn.close
set conn = nothing
%>
thank you in advance
Jamie