elevatedmarketing
asked on
Image Upload and passing form values for Database Integration
After Fritz has helped me immensely in getting ASPSmartUpload working, my next task is to integrate a back-end user interface that will use ASPSmartUpload to upload 2 image files along with a form with the following information:
Date :
Location :
Title :
Author :
Body :
Select a first file :
Select a second file :
Contact :
Email :
I think the easiest way FOR ME to do this is to create the form and image upload (using ASPSMartUpload) in the form, pass that form to the process page where 1) the Image Upload is processed and 2) the form values and image tags are called up into another form to "confirm" the article. Then I would pass all of these values into the database. Is this feasible? Here's my code for these two pages:
***********FORM CODE*********************
<HTML>
<BODY BGCOLOR="white">
<H1>News Story Upload</H1>
<HR>
<form METHOD="POST" ACTION="/asp/process_news. asp" NAME="PW" ENCTYPE="multipart/form-da ta">
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small ><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Date" value="mm/dd/yyyy" size="12"><br></font></sma ll></td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s mall><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Location" value="" size="40"><br></font></sma ll></td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal l><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Title" value="" size="40"><br></font></sma ll></td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma ll><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Author" value="" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"></textarea><br>< /font></sm all></td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a fi rst f ile : </font></small></td>
<td><small><font face="Verdana">
<input TYPE="file" name="Image1" size="30"></font></small>< /td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a se cond file : </font></small></td>
<td><small><font face="Verdana">
<input TYPE="file" name="Image2" size="30"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo nt face="Verdana">Contact : </font></small></td>
<td width="324"><small><font face="Verdana">
<SELECT name="Contact" size="1" ><OPTION>Select a Contact</OPTION>
<OPTION>Cy Emerus</OPTION><OPTION>Ski p Joeckel</OPTION>
<option>Adam Barrington</option>
</SELECT></font></small></ td>
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td><small><font face="Verdana"><SELECT name="Email" size="1" >
<option>Select Contact Email</option>
<OPTION value="mailto:travel@cyeme rus.com">t ravel@cyem erus.com</ OPTION>
<OPTION value="skip@cyemerus.com"> skip@cyeme rus.com</O PTION>
<OPTION value="adam@cyemerus.com"> adam@cyeme rus.com</O PTION></SE LECT><br>< /font></sm all></td>
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p> <small><fo nt face="Verdana"><input
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
</BODY>
</HTML>
***************Process Page********************
<HTML>
<BODY BGCOLOR="white">
<H1>Story Confirmation</H1>
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
%>
<form METHOD="POST" ACTION="/asp/process_news. asp" NAME="PW" ENCTYPE="multipart/form-da ta">
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small ><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Date" value="<%=Request.Form("Da te")%>" size="12"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s mall><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Location" value="<%=Request.Form("Lo cation")%> " size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal l><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Title" value="<%=Request.Form("Ti tle")%> " size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma ll><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Author" value="<%=Request.Form("Au thor")%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"><%=Request.Form( "Body")%>< /textarea> </font></s mall></td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a fi rst f ile : </font></small></td>
<td>
<input type="text" name="Image1" size="40" value="<%=Request.Form("Im age1")%>"> </td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a se cond file : </font></small></td>
<td>
<input type="text" name="Image2" size="40" value="<%=Request.Form("Im age2")%>"> </td>
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo nt face="Verdana">Contact : </font></small></td>
<td width="324">
<input type="text" name="Contact" size="20" value="<%=Request.Form("Co ntact")%>" ></td>
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td>
<input type="text" name="Email" size="20" value="<%=Request.Form("Em ail")%>">< /td>
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p> <small><fo nt face="Verdana"><input
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
</BODY>
</HTML>
************************** ********** *
I know that my database connections aren't in there yet. I'm going to do that after I can call these values correctly into the confirmation form. Am I doing this right?
Thanks for all the help!
Adam
Date :
Location :
Title :
Author :
Body :
Select a first file :
Select a second file :
Contact :
Email :
I think the easiest way FOR ME to do this is to create the form and image upload (using ASPSMartUpload) in the form, pass that form to the process page where 1) the Image Upload is processed and 2) the form values and image tags are called up into another form to "confirm" the article. Then I would pass all of these values into the database. Is this feasible? Here's my code for these two pages:
***********FORM CODE*********************
<HTML>
<BODY BGCOLOR="white">
<H1>News Story Upload</H1>
<HR>
<form METHOD="POST" ACTION="/asp/process_news.
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small
<td width="324"><small><font face="Verdana">
<input name="Date" value="mm/dd/yyyy" size="12"><br></font></sma
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s
<td width="324"><small><font face="Verdana">
<input name="Location" value="" size="40"><br></font></sma
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal
<td width="324"><small><font face="Verdana">
<input name="Title" value="" size="40"><br></font></sma
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma
<td width="324"><small><font face="Verdana">
<input name="Author" value="" size="40"></font></small><
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"></textarea><br><
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td><small><font face="Verdana">
<input TYPE="file" name="Image1" size="30"></font></small><
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td><small><font face="Verdana">
<input TYPE="file" name="Image2" size="30"></font></small><
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo
<td width="324"><small><font face="Verdana">
<SELECT name="Contact" size="1" ><OPTION>Select a Contact</OPTION>
<OPTION>Cy Emerus</OPTION><OPTION>Ski
<option>Adam Barrington</option>
</SELECT></font></small></
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td><small><font face="Verdana"><SELECT name="Email" size="1" >
<option>Select Contact Email</option>
<OPTION value="mailto:travel@cyeme
<OPTION value="skip@cyemerus.com">
<OPTION value="adam@cyemerus.com">
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p>
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
</BODY>
</HTML>
***************Process Page********************
<HTML>
<BODY BGCOLOR="white">
<H1>Story Confirmation</H1>
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
%>
<form METHOD="POST" ACTION="/asp/process_news.
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small
<td width="324"><small><font face="Verdana">
<input name="Date" value="<%=Request.Form("Da
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s
<td width="324"><small><font face="Verdana">
<input name="Location" value="<%=Request.Form("Lo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal
<td width="324"><small><font face="Verdana">
<input name="Title" value="<%=Request.Form("Ti
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma
<td width="324"><small><font face="Verdana">
<input name="Author" value="<%=Request.Form("Au
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"><%=Request.Form(
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td>
<input type="text" name="Image1" size="40" value="<%=Request.Form("Im
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td>
<input type="text" name="Image2" size="40" value="<%=Request.Form("Im
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo
<td width="324">
<input type="text" name="Contact" size="20" value="<%=Request.Form("Co
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td>
<input type="text" name="Email" size="20" value="<%=Request.Form("Em
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p>
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
</BODY>
</HTML>
**************************
I know that my database connections aren't in there yet. I'm going to do that after I can call these values correctly into the confirmation form. Am I doing this right?
Thanks for all the help!
Adam
The way to get around that is like this. Instead of:
value="<%=Request.Form("Da te")%>"
Try:
value="<%=mySmartUpload.Fo rm("Date") %>"
FtB
value="<%=Request.Form("Da
Try:
value="<%=mySmartUpload.Fo
FtB
ASKER
Yes, I only want to store the path (the full path: http://www.elevatedmarketing.com/uploads/news/filename) in the DB. And I've also found that Request.Form("Body") will not work as well. Is there a work around?
I guess what I'm what I'm wanting to do is create this interface to where the user completes the entire form on one page, including browsing to upload files, then process the upload and then pass those form values back into a "confirmation" form along with an image view of the files they just uploaded and then they hit "submit" once more to actually insert those values into the DB. Is this possible?
Adam
I guess what I'm what I'm wanting to do is create this interface to where the user completes the entire form on one page, including browsing to upload files, then process the upload and then pass those form values back into a "confirmation" form along with an image view of the files they just uploaded and then they hit "submit" once more to actually insert those values into the DB. Is this possible?
Adam
Do you want this all on one page or can we break it up?
Please see my last page as a workaround for getting the form values.
FtB
Please see my last page as a workaround for getting the form values.
FtB
ASKER
Ok. This is what I have now. I'm using the code that we got working yesterday for ASPSmartUpload, but since I'm uploading 2 files, I'm not sure it's working right.
****************Form****** ********** **********
<HTML>
<head>
<meta http-equiv="Content-Langua ge" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>htmlarea test</title>
<script language="Javascript1.2">< !-- // load htmlarea
_editor_url = ""; // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVe rsion.spli t("MSIE")[ 1]);
if (navigator.userAgent.index Of('Mac') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.index Of('Window s CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.index Of('Opera' ) >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
document.write(' language="Javascript1.2">< /scr' + 'ipt>');
} else { document.write('<scr'+'ipt >function editor_generate() { return false; }</scr'+'ipt>'); }
// --></script>
</head>
<BODY BGCOLOR="white">
<H1>News Story Upload</H1>
<HR>
<form METHOD="POST" ACTION="/asp/process_news_ backup.asp " ENCTYPE="multipart/form-da ta">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small ><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Date" value="mm/dd/yyyy" size="12"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s mall><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Location" value="" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal l><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Title" value="" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma ll><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Author" value="" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"></textarea><br>< /font></sm all></td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a fi rst f ile : </font></small></td>
<td><small><font face="Verdana">
<input TYPE="file" name="Image1" size="30"></font></small>< /td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a se cond file : </font></small></td>
<td><small><font face="Verdana">
<input TYPE="file" name="Image2" size="30"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo nt face="Verdana">Contact : </font></small></td>
<td width="324"><small><font face="Verdana">
<SELECT name="Contact" size="1" ><OPTION>Select a Contact</OPTION>
<OPTION>Cy Emerus</OPTION><OPTION>Ski p Joeckel</OPTION>
<option>Adam Barrington</option>
</SELECT></font></small></ td>
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td><small><font face="Verdana"><SELECT name="Email" size="1" >
<option>Select Contact Email</option>
<OPTION value="mailto:travel@cyeme rus.com">t ravel@cyem erus.com</ OPTION>
<OPTION value="skip@cyemerus.com"> skip@cyeme rus.com</O PTION>
<OPTION value="adam@cyemerus.com"> adam@cyeme rus.com</O PTION></SE LECT></fon t></small> </td>
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p> <small><fo nt face="Verdana"><input
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
<SCRIPT language="JavaScript1.2">
editor_generate('Body');
</SCRIPT>
</BODY>
</HTML>
********************ASP Process******************* **
<HTML>
<BODY BGCOLOR="white">
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
%>
<H1>Story Confirmation</H1>
<form METHOD="POST" ACTION="--WEBBOT-SELF--" ENCTYPE="multipart/form-da ta">
<!--webbot bot="SaveDatabase" SuggestedExt="asp" S-DataConnection="cydb" S-RecordSource="News" U-Database-URL="cyemerus.m db" S-Form-Fields="Title Image1 Image2 Email Contact Author Date Body Location" S-Form-DBFields="Title Image1 Image2 Email Contact Author Date Body Location" U-ASP-Include-Url="_fpclas s/fpdbform .inc" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="_fpclass/fpdbform.in c"--><!--w ebbot bot="SaveDatabase" i-checksum="40548" endspan -->
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small ><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Date" value="<%=mySmartUpload.Fo rm("Date") %>" size="12"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s mall><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Location" value="<%=mySmartUpload.Fo rm("Locati on")%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal l><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Title" value="<%=mySmartUpload.Fo rm("Title" )%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma ll><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Author" value="<%=mySmartUpload.Fo rm("Author ")%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"><%=mySmartUpload .Form("Bod y")%>
</textarea></font></small> </td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a fi rst f ile : </font></small></td>
<td>
<input type="text" name="Image1" size="40" value="<%=mySmartUpload.Fo rm("Image1 ")%>"></td >
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a se cond file : </font></small></td>
<td>
<input type="text" name="Image2" size="40" value="<%=mySmartUpload.Fo rm("Image2 ")%>"></td >
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo nt face="Verdana">Contact : </font></small></td>
<td width="324">
<input type="text" name="Contact" size="20" value="<%=mySmartUpload.Fo rm("Contac t")%>"></t d>
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td>
<input type="text" name="Email" size="20" value="<%=mySmartUpload.Fo rm("Email" )%>"></td>
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p> <small><fo nt face="Verdana"><input
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
</BODY>
</HTML>
****************Form******
<HTML>
<head>
<meta http-equiv="Content-Langua
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>htmlarea test</title>
<script language="Javascript1.2"><
_editor_url = ""; // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVe
if (navigator.userAgent.index
if (navigator.userAgent.index
if (navigator.userAgent.index
if (win_ie_ver >= 5.5) {
document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
document.write(' language="Javascript1.2"><
} else { document.write('<scr'+'ipt
// --></script>
</head>
<BODY BGCOLOR="white">
<H1>News Story Upload</H1>
<HR>
<form METHOD="POST" ACTION="/asp/process_news_
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small
<td width="324"><small><font face="Verdana">
<input name="Date" value="mm/dd/yyyy" size="12"></font></small><
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s
<td width="324"><small><font face="Verdana">
<input name="Location" value="" size="40"></font></small><
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal
<td width="324"><small><font face="Verdana">
<input name="Title" value="" size="40"></font></small><
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma
<td width="324"><small><font face="Verdana">
<input name="Author" value="" size="40"></font></small><
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"></textarea><br><
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td><small><font face="Verdana">
<input TYPE="file" name="Image1" size="30"></font></small><
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td><small><font face="Verdana">
<input TYPE="file" name="Image2" size="30"></font></small><
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo
<td width="324"><small><font face="Verdana">
<SELECT name="Contact" size="1" ><OPTION>Select a Contact</OPTION>
<OPTION>Cy Emerus</OPTION><OPTION>Ski
<option>Adam Barrington</option>
</SELECT></font></small></
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td><small><font face="Verdana"><SELECT name="Email" size="1" >
<option>Select Contact Email</option>
<OPTION value="mailto:travel@cyeme
<OPTION value="skip@cyemerus.com">
<OPTION value="adam@cyemerus.com">
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p>
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
<SCRIPT language="JavaScript1.2">
editor_generate('Body');
</SCRIPT>
</BODY>
</HTML>
********************ASP Process*******************
<HTML>
<BODY BGCOLOR="white">
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
%>
<H1>Story Confirmation</H1>
<form METHOD="POST" ACTION="--WEBBOT-SELF--" ENCTYPE="multipart/form-da
<!--webbot bot="SaveDatabase" SuggestedExt="asp" S-DataConnection="cydb" S-RecordSource="News" U-Database-URL="cyemerus.m
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small
<td width="324"><small><font face="Verdana">
<input name="Date" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s
<td width="324"><small><font face="Verdana">
<input name="Location" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal
<td width="324"><small><font face="Verdana">
<input name="Title" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma
<td width="324"><small><font face="Verdana">
<input name="Author" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"><%=mySmartUpload
</textarea></font></small>
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td>
<input type="text" name="Image1" size="40" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td>
<input type="text" name="Image2" size="40" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo
<td width="324">
<input type="text" name="Contact" size="20" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td>
<input type="text" name="Email" size="20" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p>
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
</BODY>
</HTML>
ASKER
We can break it up, I was just having a hard time passing those form values from the 1st form to a 2nd upload process page to a final confirmation page. but if you think we should break it up... we can do it.
Here is a bit of reworking on your second page. Please let me know if it works, and then we'll move on to the next step.
FtB
FtB
ASKER
I know there's something wrong with my ASP upload processing code because it's not allowing the passing of form values using:
value="<%=mySmartUpload.Fo rm("Date") %>"
I've plugged all those "<%=mySmartUpload.Form("** ")%>" into my confirmation form, but values aren't being passed.
value="<%=mySmartUpload.Fo
I've plugged all those "<%=mySmartUpload.Form("**
Oh, hang on, let me change this. I just realized that you are using FrontPage?
Yech!!!!
FtB
Yech!!!!
FtB
Did you try using the page that I posted above to see if it worked? It would be best if we moved incrementally, step by step, so we can isolate where the errors occur.
First--the upload page is still working?
Next--what if you use the page that I had above?
ftB
First--the upload page is still working?
Next--what if you use the page that I had above?
ftB
Hang on! I see the mistake here.
We have to create an instance of the upload object on each page where we are going to do this....
FtB
We have to create an instance of the upload object on each page where we are going to do this....
FtB
ASKER
Sorry about the FP thing! Old Habits die hard! The only FP component I want to use is after we upload the files and pass the values into the form, use FP to insert said "confirmation" form into my database. You probably hate me now! But evangelizing the FrontPagers is a step-by-step process!
First--upload page that we worked on yesterday is not working in this instance i think because I added another file to be uploaded. (it also may be that it won't work because I've got that confirmation form at the bottom of the same page.
Next--I'm not sure what page above you are referencing.
First--upload page that we worked on yesterday is not working in this instance i think because I added another file to be uploaded. (it also may be that it won't work because I've got that confirmation form at the bottom of the same page.
Next--I'm not sure what page above you are referencing.
Okay, let's start over and go step by step. I will be asking for confirmation each step along the way.
Use this as your form:
<HTML>
<BODY BGCOLOR="white">
<H1>News Story Upload</H1>
<HR>
<form METHOD="POST" ACTION="/asp/process_news. asp" NAME="PW" ENCTYPE="multipart/form-da ta">
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small ><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Date" value="mm/dd/yyyy" size="12"><br></font></sma ll></td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s mall><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Location" value="" size="40"><br></font></sma ll></td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal l><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Title" value="" size="40"><br></font></sma ll></td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma ll><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Author" value="" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"></textarea><br>< /font></sm all></td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a fi rst f ile : </font></small></td>
<td><small><font face="Verdana">
<input TYPE="file" name="Image1" size="30"></font></small>< /td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a se cond file : </font></small></td>
<td><small><font face="Verdana">
<input TYPE="file" name="Image2" size="30"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo nt face="Verdana">Contact : </font></small></td>
<td width="324"><small><font face="Verdana">
<SELECT name="Contact" size="1" ><OPTION>Select a Contact</OPTION>
<OPTION>Cy Emerus</OPTION><OPTION>Ski p Joeckel</OPTION>
<option>Adam Barrington</option>
</SELECT></font></small></ td>
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td><small><font face="Verdana"><SELECT name="Email" size="1" >
<option>Select Contact Email</option>
<OPTION value="mailto:travel@cyeme rus.com">t ravel@cyem erus.com</ OPTION>
<OPTION value="skip@cyemerus.com"> skip@cyeme rus.com</O PTION>
<OPTION value="adam@cyemerus.com"> adam@cyeme rus.com</O PTION></SE LECT><br>< /font></sm all></td>
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p> <small><fo nt face="Verdana"><input
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
</BODY>
</HTML>
Then use this as your process_news_backup.asp page:
<HTML>
<BODY BGCOLOR="white">
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
%>
<H1>Story Confirmation</H1>
<form METHOD="POST" ACTION=""">
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small ><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Date" value="<%=mySmartUpload.Fo rm("Date") %>" size="12"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s mall><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Location" value="<%=mySmartUpload.Fo rm("Locati on")%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal l><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Title" value="<%=mySmartUpload.Fo rm("Title" )%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma ll><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Author" value="<%=mySmartUpload.Fo rm("Author ")%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"><%=mySmartUpload .Form("Bod y")%>
</textarea></font></small> </td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a fi rst f ile : </font></small></td>
<td>
<input type="text" name="Image1" size="40" value="<%=mySmartUpload.Fo rm("Image1 ")%>"></td >
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a se cond file : </font></small></td>
<td>
<input type="text" name="Image2" size="40" value="<%=mySmartUpload.Fo rm("Image2 ")%>"></td >
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo nt face="Verdana">Contact : </font></small></td>
<td width="324">
<input type="text" name="Contact" size="20" value="<%=mySmartUpload.Fo rm("Contac t")%>"></t d>
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td>
<input type="text" name="Email" size="20" value="<%=mySmartUpload.Fo rm("Email" )%>"></td>
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p> <small><fo nt face="Verdana"><input
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
<%
' initialize the object
Set mySmartUpload=nothing
%>
</BODY>
</HTML>
Use this as your form:
<HTML>
<BODY BGCOLOR="white">
<H1>News Story Upload</H1>
<HR>
<form METHOD="POST" ACTION="/asp/process_news.
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small
<td width="324"><small><font face="Verdana">
<input name="Date" value="mm/dd/yyyy" size="12"><br></font></sma
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s
<td width="324"><small><font face="Verdana">
<input name="Location" value="" size="40"><br></font></sma
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal
<td width="324"><small><font face="Verdana">
<input name="Title" value="" size="40"><br></font></sma
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma
<td width="324"><small><font face="Verdana">
<input name="Author" value="" size="40"></font></small><
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"></textarea><br><
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td><small><font face="Verdana">
<input TYPE="file" name="Image1" size="30"></font></small><
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td><small><font face="Verdana">
<input TYPE="file" name="Image2" size="30"></font></small><
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo
<td width="324"><small><font face="Verdana">
<SELECT name="Contact" size="1" ><OPTION>Select a Contact</OPTION>
<OPTION>Cy Emerus</OPTION><OPTION>Ski
<option>Adam Barrington</option>
</SELECT></font></small></
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td><small><font face="Verdana"><SELECT name="Email" size="1" >
<option>Select Contact Email</option>
<OPTION value="mailto:travel@cyeme
<OPTION value="skip@cyemerus.com">
<OPTION value="adam@cyemerus.com">
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p>
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
</BODY>
</HTML>
Then use this as your process_news_backup.asp page:
<HTML>
<BODY BGCOLOR="white">
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
%>
<H1>Story Confirmation</H1>
<form METHOD="POST" ACTION=""">
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small
<td width="324"><small><font face="Verdana">
<input name="Date" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s
<td width="324"><small><font face="Verdana">
<input name="Location" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal
<td width="324"><small><font face="Verdana">
<input name="Title" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma
<td width="324"><small><font face="Verdana">
<input name="Author" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"><%=mySmartUpload
</textarea></font></small>
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td>
<input type="text" name="Image1" size="40" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td>
<input type="text" name="Image2" size="40" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo
<td width="324">
<input type="text" name="Contact" size="20" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td>
<input type="text" name="Email" size="20" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p>
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
<%
' initialize the object
Set mySmartUpload=nothing
%>
</BODY>
</HTML>
So here are my questions:
1) were you able to upload the image?
2) was the form populated?
FtB
1) were you able to upload the image?
2) was the form populated?
FtB
ASKER
Brilliant... The Upload worked. Files are in the appropriate folder.
However, this is the display of the confirmation page.
Story Confirmation
Date :
Request object error 'ASP 0207 : 80004005'
Cannot use Request.Form
/asp/process_news.asp, line 55
Cannot use Request.Form collection after calling BinaryRead.
However, this is the display of the confirmation page.
Story Confirmation
Date :
Request object error 'ASP 0207 : 80004005'
Cannot use Request.Form
/asp/process_news.asp, line 55
Cannot use Request.Form collection after calling BinaryRead.
ASKER
I see the problem, let me change request.form to the value="<%=mySmartUpload.Fo rm("Date") %>"... hang on.
Sorry for the error! How did I miss that?
FtB
FtB
Are you sure that you used the second page that I posted? There is no request.form on it. The page should be:
<HTML>
<BODY BGCOLOR="white">
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
%>
<H1>Story Confirmation</H1>
<form METHOD="POST" ACTION=""">
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small ><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Date" value="<%=mySmartUpload.Fo rm("Date") %>" size="12"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s mall><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Location" value="<%=mySmartUpload.Fo rm("Locati on")%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal l><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Title" value="<%=mySmartUpload.Fo rm("Title" )%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma ll><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Author" value="<%=mySmartUpload.Fo rm("Author ")%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"><%=mySmartUpload .Form("Bod y")%>
</textarea></font></small> </td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a fi rst f ile : </font></small></td>
<td>
<input type="text" name="Image1" size="40" value="<%=mySmartUpload.Fo rm("Image1 ")%>"></td >
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a se cond file : </font></small></td>
<td>
<input type="text" name="Image2" size="40" value="<%=mySmartUpload.Fo rm("Image2 ")%>"></td >
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo nt face="Verdana">Contact : </font></small></td>
<td width="324">
<input type="text" name="Contact" size="20" value="<%=mySmartUpload.Fo rm("Contac t")%>"></t d>
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td>
<input type="text" name="Email" size="20" value="<%=mySmartUpload.Fo rm("Email" )%>"></td>
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p> <small><fo nt face="Verdana"><input
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
<%
' initialize the object
Set mySmartUpload=nothing
%>
</BODY>
</HTML>
<HTML>
<BODY BGCOLOR="white">
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
%>
<H1>Story Confirmation</H1>
<form METHOD="POST" ACTION=""">
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small
<td width="324"><small><font face="Verdana">
<input name="Date" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s
<td width="324"><small><font face="Verdana">
<input name="Location" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal
<td width="324"><small><font face="Verdana">
<input name="Title" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma
<td width="324"><small><font face="Verdana">
<input name="Author" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"><%=mySmartUpload
</textarea></font></small>
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td>
<input type="text" name="Image1" size="40" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td>
<input type="text" name="Image2" size="40" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo
<td width="324">
<input type="text" name="Contact" size="20" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td>
<input type="text" name="Email" size="20" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p>
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
<%
' initialize the object
Set mySmartUpload=nothing
%>
</BODY>
</HTML>
ASKER
wait a second... It already has the <%=mySmartUpload.Form("for mvaluehere ")%> in each of the confirmation form fields.
Please make sure that you were pointing to the second page that I posted. You may need to clear your cache and refresh you page a few times.
FtB
FtB
ASKER
I promise you that I just used your code for the second page. It did upload the file, however it posted the following error in the confirmation table beside the date field:
Request object error 'ASP 0207 : 80004005'
Cannot use Request.Form
/asp/process_news.asp, line 55
Cannot use Request.Form collection after calling BinaryRead.
Request object error 'ASP 0207 : 80004005'
Cannot use Request.Form
/asp/process_news.asp, line 55
Cannot use Request.Form collection after calling BinaryRead.
ASKER
ok. I'll try that.
ASKER
Alright, I cleared the cache and reloaded several times. Same thing.
I deleted process_news_backup.asp off the server and reposted it.
Still I get the same error.
THe good news is that the upload is still working!
I deleted process_news_backup.asp off the server and reposted it.
Still I get the same error.
THe good news is that the upload is still working!
Also, please make sure that you are pointing to the correct second page from your first.
FtB
FtB
Okay, let's do this to make sure. On your first page, set the action to this:
<form METHOD="POST" ACTION="/asp/process_fritz .asp" NAME="PW" ENCTYPE="multipart/form-da ta">
Next, take my last post for the process page and save it as process_fritz.asp
Then let's see what happens.
FtB
<form METHOD="POST" ACTION="/asp/process_fritz
Next, take my last post for the process page and save it as process_fritz.asp
Then let's see what happens.
FtB
ASKER
That worked beautifully! The file is uploaded. Almost all the forms are correctly populated.
Except for the image upload forms. They're just blank.
Except for the image upload forms. They're just blank.
I had expected that! The file input does not return a value I don't think. We are going to have to grab the names of the images and either repopulate the fields or display the images themselves. Which way would you prefer to go here?
FtB
FtB
ASKER
I'd be fine to display the images themselves on this confirmation form. However, I also need a path value to input into the database. What do you think?
I am guessing that we will probably use one and the same....
Let's try this now:
<HTML>
<BODY BGCOLOR="white">
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 250 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
dim arrImages(2)
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
arrImages(intCount) = filename
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
%>
<H1>Story Confirmation</H1>
<form METHOD="POST" ACTION=""">
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small ><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Date" value="<%=mySmartUpload.Fo rm("Date") %>" size="12"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s mall><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Location" value="<%=mySmartUpload.Fo rm("Locati on")%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal l><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Title" value="<%=mySmartUpload.Fo rm("Title" )%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma ll><font face="Verdana"> : </font></small></td>
<td width="324"><small><font face="Verdana">
<input name="Author" value="<%=mySmartUpload.Fo rm("Author ")%>" size="40"></font></small>< /td>
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"><%=mySmartUpload .Form("Bod y")%>
</textarea></font></small> </td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a fi rst f ile : </font></small></td>
<td>
<input type="text" name="Image1" size="40" value="<%=arrImages(0)%>"> </td>
</tr>
<tr>
<td><small><font face="Verdana">Select  ;a se cond file : </font></small></td>
<td>
<input type="text" name="Image2" size="40" value="<%=arrImages(1)%>"> </td>
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo nt face="Verdana">Contact : </font></small></td>
<td width="324">
<input type="text" name="Contact" size="20" value="<%=mySmartUpload.Fo rm("Contac t")%>"></t d>
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td>
<input type="text" name="Email" size="20" value="<%=mySmartUpload.Fo rm("Email" )%>"></td>
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p> <small><fo nt face="Verdana"><input
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
<%
' initialize the object
Set mySmartUpload=nothing
%>
</BODY>
</HTML>
FtB
Let's try this now:
<HTML>
<BODY BGCOLOR="white">
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 250 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
dim arrImages(2)
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
arrImages(intCount) = filename
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
%>
<H1>Story Confirmation</H1>
<form METHOD="POST" ACTION=""">
<input TYPE="hidden" name="myHidden" value="hidden">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Date</font><small
<td width="324"><small><font face="Verdana">
<input name="Date" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Location</font><s
<td width="324"><small><font face="Verdana">
<input name="Location" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Title</font><smal
<td width="324"><small><font face="Verdana">
<input name="Title" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left">
<font face="Verdana" style="font-size: smaller">Author</font><sma
<td width="324"><small><font face="Verdana">
<input name="Author" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td width="150"><div align="left"><small><font face="Verdana">Body : </font></small></td>
<td width="324"><small><font face="Verdana">
<textarea name="Body" rows="10" value="" cols="40"><%=mySmartUpload
</textarea></font></small>
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td>
<input type="text" name="Image1" size="40" value="<%=arrImages(0)%>">
</tr>
<tr>
<td><small><font face="Verdana">Select 
<td>
<input type="text" name="Image2" size="40" value="<%=arrImages(1)%>">
</tr>
<tr>
<td width="150"><div align="left"><p><small><fo
<td width="324">
<input type="text" name="Contact" size="20" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td><div align="left"><small><font face="Verdana">Email : </font></small></td>
<td>
<input type="text" name="Email" size="20" value="<%=mySmartUpload.Fo
</tr>
<tr>
<td colspan="2" width="474"><div align="center"><center><p>
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>
<%
' initialize the object
Set mySmartUpload=nothing
%>
</BODY>
</HTML>
FtB
ASKER
OK. Almost there. It populated the Image Fields with this:
Select a first file : C:\Accounts\elevated\wwwRo ot\asp\upl oads\news\ couple.jpg
Select a second file : C:\Accounts\elevated\wwwRo ot\asp\upl oads\news\ couple laughing.jpg
Will that be a valid path for me to input into the DB to later recall that image?
Select a first file : C:\Accounts\elevated\wwwRo
Select a second file : C:\Accounts\elevated\wwwRo
Will that be a valid path for me to input into the DB to later recall that image?
It all depends what you want to do with it!!!!
If you would prefer something different, you could store only part of the path like this:
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
arrImages(intCount) = "\uploads\news\" & filename
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
FtB
If you would prefer something different, you could store only part of the path like this:
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
arrImages(intCount) = "\uploads\news\" & filename
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
FtB
ASKER
I could use just the \uploads\news\filename when I call the images and just fill in the rest of the tag line.
Is it possible to actually display the image from here as well?
Is it possible to actually display the image from here as well?
ASKER
I'd actually prefer to store the entire http:// tag and just call it as the image source.
ASKER
After using that last code, this is what it displays in the confirmation form:
Select a first file : \uploads\news\
Select a second file :
\uploads\news\C:\Accounts\ elevated\w wwRoot\asp \uploads\n ews\prayin g.jpg
Select a first file : \uploads\news\
Select a second file :
\uploads\news\C:\Accounts\
Well, you may want to create a test page and play with this. Having the fully qualified path may be the easiest thing, so try this:
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
arrImages(intCount) = "http://www.ElevatedMarketing.com\uploads\news\" & filename
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
To display your image, then, you would do something like:
<img src="<%=arrImages(0)%>">
<img src="<%=arrImages(1)%>">
FtB
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
arrImages(intCount) = "http://www.ElevatedMarketing.com\uploads\news\" & filename
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\news\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
To display your image, then, you would do something like:
<img src="<%=arrImages(0)%>">
<img src="<%=arrImages(1)%>">
FtB
ASKER
Ok, this is what we're returning now:
Select a first file : http://www.ElevatedMarketing.com\asp\uploads\news\
Select a second file : http://www.ElevatedMarketing.com\asp\uploads\news\C:\Accounts\elevated\wwwRoot\asp\uploads\news\woman praying.jpg
I've copied your code exactly. I've also done the img src as well and they return red x's. Properties state the URL as the above tags.
Select a first file : http://www.ElevatedMarketing.com\asp\uploads\news\
Select a second file : http://www.ElevatedMarketing.com\asp\uploads\news\C:\Accounts\elevated\wwwRoot\asp\uploads\news\woman praying.jpg
I've copied your code exactly. I've also done the img src as well and they return red x's. Properties state the URL as the above tags.
ASKER
I'm learning... I found the problem! it was the filename in the array should have been file.FileName instead of just filename!
I can't beleive I fixed something on my own!
I can't beleive I fixed something on my own!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Two last questions:
1. Is there anyway to make the confirmation field that is calling that image tags UNEDITABLE so that the user can see what's there but not change it? He wouldn't ever need to change it since it points directly to the image that's already been uploaded.
1. As I'm new to EE, to which post above should I accept as the answer?
1. Is there anyway to make the confirmation field that is calling that image tags UNEDITABLE so that the user can see what's there but not change it? He wouldn't ever need to change it since it points directly to the image that's already been uploaded.
1. As I'm new to EE, to which post above should I accept as the answer?
For your first question, try this:
<input type="text" name="Image2" size="40" value="<%=arrImages(1)%>" readonly=true onFocus="Blur()">
As for the second, let's go with ID: 12044632
FtB
<input type="text" name="Image2" size="40" value="<%=arrImages(1)%>" readonly=true onFocus="Blur()">
As for the second, let's go with ID: 12044632
FtB
ASKER
That works! You are a brilliant, brilliant man!
Glad to have helped!
FtB
FtB
ASKER
I don't see where that ID number is listed: 12044632
Comment from fritz_the_blank
Date: 09/13/2004 11:00AM EDT
ID: 12044632
It is the last long post that I made. That is probably the best one to select as it is the most complete.
FtB
Date: 09/13/2004 11:00AM EDT
ID: 12044632
It is the last long post that I made. That is probably the best one to select as it is the most complete.
FtB
ASKER
Fritz--You've saved my butt. I should be able to create the other user interfaces I need to from here on out. However, I may be posting if I get stuck. The other interfaces I need to do are very similar to this one--two images with an article. I will need to do one where the user uploads his radio show on WMA with a small description article, but that should be a piece of cake compared to this one.
Is there a size limit to the files that can be uploaded with ASPSmartUpload? I know I can adjust the size limit, but is there an inherent limit? (If that needs to be another thread, I'll be glad to do that. I'm not sure how this whole "new thread/old thread" thing works.
Is there a size limit to the files that can be uploaded with ASPSmartUpload? I know I can adjust the size limit, but is there an inherent limit? (If that needs to be another thread, I'll be glad to do that. I'm not sure how this whole "new thread/old thread" thing works.
I am glad that I could lend a hand.
As far as new / existing thread stuff goes, try to imagine that you are seaching for a solution using the search engine: it is easiest if each thread concerns a specific issue.
In this case, we have a thread for passing values from one form to another when using an upload component. Posting this to the database might be best as a separate thread.
As far as the size of the file goes, if you go much beyond 1 meg you may start running into issues. The code that we have above limits the size to 250 k for each image. Please let me know if we need to modify this.
Do you need help posting these values to a database or are you set with that?
FtB
As far as new / existing thread stuff goes, try to imagine that you are seaching for a solution using the search engine: it is easiest if each thread concerns a specific issue.
In this case, we have a thread for passing values from one form to another when using an upload component. Posting this to the database might be best as a separate thread.
As far as the size of the file goes, if you go much beyond 1 meg you may start running into issues. The code that we have above limits the size to 250 k for each image. Please let me know if we need to modify this.
Do you need help posting these values to a database or are you set with that?
FtB
ASKER
I may need some help with DB. I think I could do it via FP, but I'm learning to that i need to stay away from FP as much as possible. I'll post here to notify you of a new thread for DB if need be.
Okay, I'll get working on a solution for you as I won't be around tomorrow. What is the name of your database, and what directory is it in? I take it that it is an Access database named cyemerus.mdb?
FtB
FtB
ASKER
It is an Access DB called cyemerus.mdb.
Table: news
It is in directory wwwroot/asp
Table: news
It is in directory wwwroot/asp
Okay, if you feel like posting the question now, I can give you some code to work with.
FtB
FtB
ASKER
I've already snagged. New thread is here:
https://www.experts-exchange.com/questions/21129027/To-Use-FrontPage-Database-Utility-or-Not-to-Use-FrontPage-Database-Utiliity-That-is-the-question.html
https://www.experts-exchange.com/questions/21129027/To-Use-FrontPage-Database-Utility-or-Not-to-Use-FrontPage-Database-Utiliity-That-is-the-question.html
Also, this will not work: Request.Form("Body") since your form has this: ENCTYPE="multipart/form-da
Fritz the Blank