Question
uploading images
i have done a tutorial on uploading images to my server the
images were uploading but the data was not going into the database
so i added a command and it wont work now at all ill post the code
from uploadThisFile.asp the name of the form on fileUpload is form1
- Browse file name is Filename - Description field is Description
if anyone has 10 minutes to spare please help
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/robdalt_starsearch.asp" -->
<!--#include file="Upload.asp" -->
<%
'Upload the image file and get reference to component
Dim Uploader, File
Set Uploader = GetASPUploader
'Use AddFile method to add file objects and change their properties as needed
Set File = Uploader.AddFile("file")
'The the properties of the upload
File.ValidFileTypes = "doc,pdf,txt,mdb,jpg,gif,bpm,png"
File.MaxSize = 1024*1024
File.Overwrite = false 'Do not overwrite, create unique filename
'Set the folder name to where the file will be uploaded to
Uploader.Destination = "D:\hshome\robdalto\starsearchentertainment.com\images\uploadedfiles\"
'Set longer timeout for large files if needed
Server.ScriptTimeout = 900
'Enable error handling to catch and handle errors during upload. For example, if user cancels the upload or attempts to upload files of invalid (unallowed) type or size, ASPUploader will raise an exception (error) with relevant description
On Error Resume Next
'Start receiving and saving file(s):
Uploader.Upload
'Check for errors:
If Err Then
'Redirect with error message
Response.Write err.description
Response.End()
set cAddDetail = Server.CreateObject("ADODB.Command")
cAddDetail.ActiveConnection = MM_robdalt_starsearch_STRING
cAddDetail.CommandText = "INSERT INTO tblUploadedFiles ( Filename,
Description ) VALUES ( '" & File.Name & "', '" &
Uploader.Form("description") & "' ) "
Response.Write cAddDetail.CommandText
Response.End
cAddDetail.CommandType = 1
cAddDetail.CommandTimeout = 0
cAddDetail.Prepared = true
cAddDetail.Execute()
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>uploadThisFile</title>
</head>
<body>
</body>
</html>
Thanks.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/robdalt_starsearch.asp" -->
<!--#include file="Upload.asp" -->
<%
'Upload the image file and get reference to component
Dim Uploader, File
Set Uploader = GetASPUploader
'Use AddFile method to add file objects and change their properties as needed
Set File = Uploader.AddFile("file")
'The the properties of the upload
File.ValidFileTypes = "doc,pdf,txt,mdb,jpg,gif,bpm,png"
File.MaxSize = 1024*1024
File.Overwrite = false 'Do not overwrite, create unique filename
'Set the folder name to where the file will be uploaded to
Uploader.Destination = "D:\hshome\robdalto\starsearchentertainment.com\images\uploadedfiles\"
'Set longer timeout for large files if needed
Server.ScriptTimeout = 900
'Enable error handling to catch and handle errors during upload. For example, if user cancels the upload or attempts to upload files of invalid (unallowed) type or size, ASPUploader will raise an exception (error) with relevant description
On Error Resume Next
'Start receiving and saving file(s):
Uploader.Upload
'Check for errors:
If Err Then
'Redirect with error message
Response.Write err.description
Response.End()
set cAddDetail = Server.CreateObject("ADODB.Command")
cAddDetail.ActiveConnection = MM_robdalt_starsearch_STRING
cAddDetail.CommandText = "INSERT INTO tblUploadedFiles ( Filename,
Description ) VALUES ( '" & File.Name & "', '" &
Uploader.Form("description") & "' ) "
Response.Write cAddDetail.CommandText
Response.End
cAddDetail.CommandType = 1
cAddDetail.CommandTimeout = 0
cAddDetail.Prepared = true
cAddDetail.Execute()
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>uploadThisFile</title>
</head>
<body>
</body>
</html>
Thanks.
