Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 7th, 2007, 11:22 AM
rootdaddy rootdaddy is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 8 rootdaddy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 9 sec
Reputation Power: 0
Send a message via AIM to rootdaddy
Please help me find the problem ...

I'm sorry that I posted this incorrectly yesterday, but I'm still very new to ASP programming. I took this job before the IT guy asked me to redo the site in ASP. I've been having one heck of a problem with inserting a photo upload and display for the site. I'm using a Microsoft Access database to store the images in and ASP Upload as the upload component. Here are the codes for the new post ASP file and the default ASP file, which is used to display the posts. I'm not getting any error codes, but the images are not being uploaded or displayed. All of the text items from the new post are displaying themselves, the only thing missing is the photo. If anyone could help me figure out why this is, I'd be totally stoked. I really need to finish this job ASAP (code wraps on them this time)

First, the new post:

[CODE]
<html>
<head>
<server ="http://www.alliftlb.com/lift_trucks/inc/js_functions.js" type="text/javascript"></server>
<style>
.pageTitle {font-family:verdana,arial,sans-serif;font-size:18px;color:black;font-weight:bold;}
</style>
</head>
<body style="margin:0;" >
<!-- #include file="inc/header.asp"-->

<table width=95% cellpadding=0 cellspacing=0 border=0 align=center>
<form action=new_post.asp method=post name=text_form onsubmit="javascript:return ValidateForm(this)">
<input type=hidden name=action value=post>
<tr bgcolor=efefef>
<td height=27 colspan=2>
<table width="100%" cellpadding=0 cellspacing=0 border=0>
<tr>
<td nowrap ><input type=button style="width:150;background-color:efefef" onclick="javascript:location.href='admin_edit_main.asp'" value="Admin Home">
<input type=button style="width:150;background-color:efefef" onclick="javascript:location.href='default.asp'" value="Lift Trucks Main" >

</td>
<td style="width: 100%"></td>
<td><input type=submit value="Post" style="background-color:efefef"></td>
</tr>
</table>
</td>
</tr>
</table>
<p align="right"> Equipment Type:
<input name="equip_type" type="text" style="width:30%;align=center;height:20;" value="">
</p>
<p align="right">Manufacturer:
<input name="manu" type="text" style="width:30%;align=center;height:20;" value="">
</p>
<p align="right"> Year:
<input name="year_made" type="text" style="width:30%;align=center;height:20;" value="">
</p>
<p align="right"> Model Number:
<input name="model_num" type="text" style="width:30%;align=center;height:20;" value="">
</p>
<p align="right">Serial Number:
<input name="serial_num" type="text" style="width:30%;align=center;height:20;" value="">
</p>
<p align="right">Odometer Reading:
<input name="odo_read" type="text" style="width:30%;align=center;height:20;" value="">
</p>
<p align="right"> Hour Meter Reading:
<input name="hour_read" type="text" style="width:30%;align=center;height:20;" value="">
</p>
<p align="right">Attachment Type:
<input name="attach_type" type="text" style="width:30%;align=center;height:20;" value="">
</p>
<p align="right">Capacity:
<input name="capacity" type="text" style="width:30%;align=center;height:20;" value="">
</p>
<p align="right">Price:
<input name="price" type="text" style="width:30%;align=center;height:20;" value="">
</p>
<p align="right"> E-mail:
<input name="email" type="text" style="width:30%;align=center;height:20;" value="">
</p>
<p align="center">Features: </p>
<p align="right"> <BR>
<textarea name="post_body" wrap=virtual style="width:95%;align=center;height:200;"></textarea>
</p>

<TABLE BORDER=0 align="center">
<tr><td><b>Select a file to upload:</b><INPUT TYPE=FILE SIZE=50 NAME="OLE_Object"></td></tr>
</TABLE>
<table width="95%" align=center cellpadding=0 cellspacing=0 border=0>
<tr>
<td>Enter Post Title:<input type="text" style="width:100%" value="" name="post_title">
<BR>
</td>
</tr>
</table>
</form>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>

<%else
'process the form

'remove single quotes which annoy the database
post_title=trim(replace(Request.Form("post_title"),"'","'"))
equip_type=trim(replace(Request.Form("equip_type"),"'","'"))
manu=trim(replace(Request.Form("manu"),"'","'"))
year_made=trim(replace(Request.Form("year_made"),"'","'"))
model_num=trim(replace(Request.Form("model_num"),"'","'"))
serial_num=trim(replace(Request.Form("serial_num"),"'","'"))
odo_read=trim(replace(Request.Form("odo_read"),"'","'"))
hour_read=trim(replace(Request.Form("hour_read"),"'","'"))
attach_type=trim(replace(Request.Form("attach_type"),"'","'"))
capacity=trim(replace(Request.Form("capacity"),"'","'"))
price=trim(replace(Request.Form("price"),"'","'"))
email=trim(replace(Request.Form("email"),"'","'"))
post_body=trim(replace(Request.Form("post_body"),"'","'"))
'replace textarea line breaks with html breaks.
post_body=replace(post_body,chr(13),"<br>")

'insert the record
sql="insert into posts( post_date ,post_title ,equip_type ,manu ,year_made ,model_num ,serial_num ,odo_read ,hour_read ,attach_type ,capacity ,price ,email ,post_body ) " & _
" values (now(),'" & post_title & "','"& equip_type & "','" & manu & "','" & year_made & "','" & model_num & "','" & serial_num &"','" & odo_read & "','" & hour_read &"','" & attach_type & "','" & capacity & "','" & price & "','" & email & "','" & post_body & "')"

Set Upload = Server.CreateObject("Persits.Upload")

Set File = Upload.Files("OLE_Object")

If Not File Is Nothing Then

Connect = "Driver={Microsoft Access Driver (*.mdb)};DBQ=http://www.alliftlb.com/lift_trucks/blog.mdb"

SQL = "INSERT INTO posts (OLE_Object, filename) VALUES(?, '"
SQL = SQL & File.Filename & "', '"


File.ToDatabase Connect, SQL

Response.Write "File saved."

Else

Response.Write "File not selected."

End If


objconn.execute(sql)%>
<!-- #include file="inc/cleanupinc.asp"-->
<%
'redirect to blog home page.
Response.Redirect "default.asp"


end if%>

Reply With Quote
  #2  
Old March 7th, 2007, 11:27 AM
rootdaddy rootdaddy is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 8 rootdaddy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 9 sec
Reputation Power: 0
Send a message via AIM to rootdaddy
Second, the default code:

[CODE]<%
if Request.QueryString("archive")<>"" then
iPage=Request.QueryString("archive")
else
ipage=1
end if




SQL="select post_id,email ,post_date ,equip_type ,manu ,year_made ,model_num ,serial_num ,odo_read ,hour_read ,attach_type ,capacity ,price, post_body,OLE_Object " & _
"from posts" & _
" order by post_date desc"

objrs.open sql,objconn,1,2
if not objrs.eof then
'set the recordset page size
objRS.PageSize=10
totcount=objrs.recordcount
'temp number to count down from
reccount=10
'move to the current page
objRS.AbsolutePage=iPage

'add to a string variable to display later
'this is the page number links for the archive.
recstring= ""

ic=0
if totcount>0 then
for i = 1 to totcount step 10
ic=ic+1
if cint(ic)=cint(ipage) then
recstring=recstring& "<span style=""background-colorrange"">&nbsp;" & ic & "&nbsp;</span>&nbsp;|&nbsp;"
else
recstring=recstring& "<a href=default.asp?archive="&ic & ">&nbsp;" & ic & "&nbsp;</a>&nbsp;|&nbsp;"
end if
next
end if


'now loop through the current page.
while not objrs.eof and reccount>0
reccount=reccount-1

Response.write"<div style=""border:1px solid silver;background-color:eeeeee;font-family:verdana;font-size:12px"">"
Response.Write "<div style=""display:inline;font-size:11px"" align=right>"
Response.write "<b>[ Posted at " & formatdatetime(objrs("post_date"),4) & " "
Response.write "on " & formatdatetime(objrs("post_date"),1) & "</i> ]</b><BR>"
Response.BinaryWrite objrs("OLE_Object") & "<BR>"
Response.Write "<BR>" & "<b>Equipment Type:</b> " & objrs("equip_type") & "<BR>"
Response.Write "<BR>" & "<b>Manufacturer:</b> " & objrs("manu") & "<BR>"
Response.Write "<BR>" & "<b>Year:</b> " & objrs("year_made") & "<BR>"
Response.Write "<BR>" & "<b>Odometer Reading:</b> " & objrs("odo_read") & "<BR>"
Response.Write "<BR>" & "<b>Hour Meter Reading:</b> " & objrs("hour_read") & "<BR>"
Response.Write "<BR>" & "<b>Attachment Type:</b> " & objrs("attach_type") & "<BR>"
Response.Write "<BR>" & "<b>Capacity:</b> " & objrs("capacity") & "<BR>"
Response.Write "<BR>" & "<b>Price:</b> " & objrs("price") & "<BR>"
Response.Write "<BR>" & "<b>Features:</b> " & objrs("post_body") & "<BR>"
Response.Write "<BR>" & "<b>Email Us:</b> " & "&nbsp&nbsp<a href=mailto:willyw@alliftlb.com>Click Here! </a>" & "<BR>"
Response.write "</div></div>"
Response.Write "<BR><BR>"

objrs.movenext

wend


end if


Response.Write "<BR><BR><b> Lift Trucks<BR>"
'output the string we created earlier
Response.Write recstring & "<BR>"


%> </div>

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Please help me find the problem ...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 9 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek