Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 02-22-2007, 04:59 PM Uploading Images
Experienced Talker

Posts: 39
Name: Rob
Trades: 0
ive done a tutorial uploading files to a database the images are going into the database but the description and address are not going into the database anyone know why
starsearch is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-22-2007, 05:21 PM Re: Uploading Images
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
You really don't want to store the binary image in the database. Things will work much better on several fronts if you instead keep the image in the file system and use the database to store the name and path of the image.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-22-2007, 05:26 PM Re: Uploading Images
Experienced Talker

Posts: 39
Name: Rob
Trades: 0
i keep the images in a floder the form uploads the file to a folder but i have a description field and its not registering and when the form sends the image the page goes blank how do i redirect it to my profile page and why is the data not registering in the database
starsearch is offline
Reply With Quote
View Public Profile
 
Old 02-22-2007, 05:27 PM Re: Uploading Images
Experienced Talker

Posts: 39
Name: Rob
Trades: 0
the name of the path is not registering into the database either just uploading the image to the databas
starsearch is offline
Reply With Quote
View Public Profile
 
Old 02-22-2007, 05:41 PM Re: Uploading Images
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
The likely answer to both questions is that the query to put them into your database is either defective or (my guess) non-existent.

You can't just upload stuff and expect it to show up in your database. You have to have a query to put the requisite information in there too.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 02-22-2007, 05:44 PM Re: Uploading Images
Experienced Talker

Posts: 39
Name: Rob
Trades: 0
if i use a recordset and direct the info to the database will this not effect the image upload
starsearch is offline
Reply With Quote
View Public Profile
 
Old 02-22-2007, 06:09 PM Re: Uploading Images
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Recordsets might be able to put information into the database for you, if you configure everything right, but it's really not what you want to do.

Instead use an insert query. Or better yet a stored procedure. Probably you have a static recordset.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-22-2007, 06:51 PM Re: Uploading Images
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Agreed. Insert query (or update query if something already exists) is the way to go. But process the upload first...let the file upload, and then worry about where it's going, and then once it's there process your query.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 02-26-2007, 08:58 PM Re: Uploading Images
Experienced Talker

Posts: 39
Name: Rob
Trades: 0
i have done a tutorial for uploading images the images were going into the folder but when i added the command for uploading the data to the database nbothing is working now just wont display anything
browse file name = Filename
description = Description
form = form1

the name of the desription field is Description
file field = Filename
form = form1

'Add the details of the uploaded file to the database
Dim myFile, myDescription
myFile=Filename
myDescription=Uploader.Form("Description")

set cAddDetail = Server.CreateObject("ADOBE.Command")
cAddDetail.ActiveConnection = MM_robdalt_starsearch_STRING
cAddDetail.CommandText = "INSERT INTO tblUploadedFiles (Filename,
Description ) VALUES ( '" & myFile & "', '" &
myDescription & "' ) "
cAddDetail.CommandType = 1
cAddDetail.CommandTimeout = 0
cAddDetail.Prepared = true
cAddDetail.Execute()

anyone help
starsearch is offline
Reply With Quote
View Public Profile
 
Old 02-27-2007, 07:39 PM Re: Uploading Images
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Quote:
Originally Posted by starsearch View Post
set cAddDetail = Server.CreateObject("ADOBE.Command")
This is your problem, assuming this is also the code in your application and not a typographical error.

Adobe is great with Photoshop and now Flash, but they don't give a rat's behind about your database. You want ADODB.SomeObject. DB as in database.

Also you probably don't want a timeout value of zero. You can set something like 180 seconds if you want to avoid timeouts in general, but zero can hang your code. This is just a general tip that will help you avoid trouble in the future, it won't solve today's problem.

Also, the way you're doing things with dynamic SQL, if the user types ' or " into the description field ( Joey's Birthday Party ) it won't work. You need to either escape the quotes ( you could use a string replace function to turn " into Chr$(34) ), or the better solution is to use a stored procedure. Even if this is an Access database, you can set up an INSERT query and save it under the queries tab of your database, and in code refer to it as a proc. This way you can just pass the value without having to massage it first.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-28-2007, 02:10 PM Re: Uploading Images
Experienced Talker

Posts: 39
Name: Rob
Trades: 0
have a fileUpload.asp page that allows a user to upload file

When the form on this page uploads it opens another page uploadThisFile.asp to actually upload the info to database and folder

i want to direct the user back to their peoplephotos.asp page but this requires the peopleID param to display their details

how do i pass the peopleID param from the form page to the uploadThisFile page to their photos page
so it will display their data.

anyone help?
starsearch is offline
Reply With Quote
View Public Profile
 
Old 02-28-2007, 02:44 PM Re: Uploading Images
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
So can we take it the code changes recommended above work?

You probably already know this, but in order to redirect to a different page using ASP, you need to not send anything down to the client before redirecting. So that means uploadThisFile.asp needs to not response.write any status info, like "Congratulations, your upload works" or whatever else. You've probably figured that out, but in case.

After your uploadThisFile.asp pgae does its work, use a redirect like this:

Response.Redirect("/peoplePhotos.asp?peopleID=" + someVariableID)
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-28-2007, 03:18 PM Re: Uploading Images
Experienced Talker

Posts: 39
Name: Rob
Trades: 0
everything works fine but when the user uploads no message is sent or displayed just want to go to peoplephotos page and that requires peopleID

Response.Redirect("/peoplephotos.asp?peopleID=" + someVariableID)


is this exactly how i should put it do i need to change the + someVariableID) to my variable or is that the actual code
starsearch is offline
Reply With Quote
View Public Profile
 
Old 02-28-2007, 03:44 PM Re: Uploading Images
Experienced Talker

Posts: 39
Name: Rob
Trades: 0
this is the form action do i need to put any code into that to pass the param

<form action="uploadThisFile.asp"


then it passes it to the uploadThisFile.asp do i need to put

Dim peopleID
peopleID = Request.QueryString("peopleID")

on the uploadThisFile.asp page
if so where



that page also has to pass the peopleID param to the peoplegallery.asp page whisc will already be searching for the peopleID param to display the info


so do i put

dim url
url = "Response.Redirect "peoplegallery.asp?peopleID =" & peopleID

Response.Redirect url

where i had the Response.Redirect "peoplegallery.asp"
starsearch is offline
Reply With Quote
View Public Profile
 
Old 02-28-2007, 04:30 PM Re: Uploading Images
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
how do you keep the user logged on ???

because you simply use the same method (cookie or session variable) to retrieve the user ID
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-28-2007, 04:36 PM Re: Uploading Images
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
You don't need to put strings into variables to use them. And Response.Redirect isn't part of your url, so if you try to redirect somebody to "response.redirect http://whatever" you're going to cause an error.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-28-2007, 04:42 PM Re: Uploading Images
Experienced Talker

Posts: 39
Name: Rob
Trades: 0
all i want to do is direct the user from uploading their file to the gally i have a form that uploads the images how do i pass the peopleID from the form to the gally?


form page - goes to uploadthisfile page - goes to gallery. how do i pass the peopleID???
starsearch is offline
Reply With Quote
View Public Profile
 
Old 02-28-2007, 05:46 PM Re: Uploading Images
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Either pass it in the query string ( http://somepage.asp?ID=17 ) or store it in a session variable and extract that on the target page.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-28-2007, 06:26 PM Re: Uploading Images
Experienced Talker

Posts: 39
Name: Rob
Trades: 0
there is only 3 pages this shouldnt take this long step by step

upload.asp - -



<form action="uploadThisFile.asp?peopleID=<%=peopleID%>" method="post" enctype="multipart/form-data" name="form1">

is this correct?
starsearch is offline
Reply With Quote
View Public Profile
 
Old 02-28-2007, 06:28 PM Re: Uploading Images
Experienced Talker

Posts: 39
Name: Rob
Trades: 0
uploadThisFile.asp - -


<<A href="mailto:%@LANGUAGE="VBSCRIPT">%@LANGUAGE="VBS CRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/robdalt_starsearch.asp" -->
<!--#include file="Upload.asp" -->
<%
Dim peopleID
peopleID = Request.QueryString("peopleID")





Response.Redirect "peoplegallery.asp?peopleID=& peopleID"
starsearch is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Uploading Images

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.64463 seconds with 12 queries