Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

uploading images

New Here ,
Feb 23, 2007 Feb 23, 2007
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.
TOPICS
Server side applications
493
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 24, 2007 Feb 24, 2007
Is the upload itself failing?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"rob dalton" <webforumsuser@macromedia.com> wrote in message
news:ernp82$n4p$1@forums.macromedia.com...
>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.
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 24, 2007 Feb 24, 2007
the uploading was working but the info was not going into the database that was befor i inserted the command. then when i inserted the command it wouldnt work at all.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 24, 2007 Feb 24, 2007
checked the folder and the images were going into the folder. but the screen was staying blank. its just the command that didnt.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 24, 2007 Feb 24, 2007
LATEST
checked the folder and the images were going into the folder. but the screen was staying blank. its just the command that didnt.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines