Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieve filename from upload and insert in textbox

Status
Not open for further replies.

kiwieur

Technical User
Apr 25, 2006
200
GB
Hi Team,

Sorry it's me again

I have a form that allows us to insert 3 records from one submit, therefore I have three fields for each item (example >>> txtName1,txtName2,txtName3).

On this form the user can upload a different file for each of the 3 records and what I would like to achieve is that on each upload the file name is inserted into the correct textbox.

I use the same upload page for each of the three file uploads, this page is displayed in a popup window and I am struggling to work out how to dynamically tell the system which textfield the filename should be inserted to.

here is the source code for each of the pages used, I have tried to limit the amount of code I am pasting in so as not to cloud the issue

1. RECORD INSERT PAGE

Code:
    <td class="TextYellowRight9px">FILENAME</td>
      <td class="Text4Left10px">&nbsp;&nbsp;<a href='JavaScript:openPopWin("[URL unfurl="true"]http://MyNet/Enquiries/FileInsert.htm",[/URL] 650, 400, "", 300, 200)' class="inputBlue"><img src="../Images/FileUp.png" name="UploadFile" width="17" height="17" border="0" align="baseline" id="UploadFile" style="visibility:hidden"/></a>&nbsp;&nbsp;<input name="txtFName" type="text" class="TextLeft9px" id="txtFName" tabindex="16" size="30" maxlength="50" /></td>
      <td class="Text4Left10px">&nbsp;&nbsp;<a href='JavaScript:openPopWin("[URL unfurl="true"]http://MyNet/Enquiries/FileInsert.htm",[/URL] 650, 400, "", 300, 200)' class="inputBlue"><img src="../Images/FileUp.png" name="UploadFile2" width="17" height="17" border="0" align="baseline" id="UploadFile2" style="visibility:hidden"/></a>&nbsp;&nbsp;<input name="txtFName2" type="text" class="TextLeft9px" id="txtFName2" size="30" maxlength="50" /></td>
      <td class="Text4Left10px">&nbsp;&nbsp;<a href='JavaScript:openPopWin("[URL unfurl="true"]http://MyNet/Enquiries/FileInsert.htm",[/URL] 650, 400, "", 300, 200)' class="inputBlue"><img src="../Images/FileUp.png" name="UploadFile3" width="17" height="17" border="0" align="baseline" id="UploadFile3" style="visibility:hidden"/></a>&nbsp;&nbsp;<input name="txtFName3" type="text" class="TextLeft9px" id="txtFName3" size="30" maxlength="50" /></td>
    </tr>
    <tr>
      <td class="TextYellowRight9px">DUE DATE / TIME</td>
      <td class="Text4Left10px"><input name="txtDDT" type="text" class="TextLeft9px" id="txtDDT" value="&lt;-- Enter Date --&gt;" size="25" onchange="checkDDT()"/>
      <a href="javascript:NewCal('txtDDT','ddmmmyyyy',true,24)"><img src="../Images/cal.gif" width="16" height="16" border="0" alt="Pick a date" /></a>    <input name="txtODDT" type="hidden" class="TextLeft9px" id="txtODDT" value="" /></td>
      <td class="Text4Left10px"><input name="txtDDT2" type="text" class="TextLeft9px" id="txtDDT2" value="&lt;-- Enter Date --&gt;" size="25" />
        <a href="javascript:NewCal('txtDDT2','ddmmmyyyy',true,24)"><img src="../Images/cal.gif" width="16" height="16" border="0" alt="Pick a date">
        <input name="txtODDT2" type="hidden" class="TextLeft9px" id="txtODDT2" value="" />
        </a></td>
      <td class="Text4Left10px"><input name="txtDDT3" type="text" class="TextLeft9px" id="txtDDT3" value="&lt;-- Enter Date --&gt;" size="25"/>
      <a href="javascript:NewCal('txtDDT3','ddmmmyyyy',true,24)"><img src="../Images/cal.gif" width="16" height="16" border="0" alt="Pick a date">
      <input name="txtODDT3" type="hidden" class="TextLeft9px" id="txtODDT3" value="" />
2.FILE UPLOAD PAGE

Code:
<html>
<head>
	<title>File Uploading with ASP</title>
	<style>
		body, input { font-family:verdana,arial; font-size:10pt; }
	body {
	margin-left: 0px;
	margin-top: 0px;
}
    </style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="../Styles/Text.css" rel="stylesheet" type="text/css" />
<link href="../Styles/MainStyles.css" rel="stylesheet" type="text/css" />
<link href="../Styles/Layout.css" rel="stylesheet" type="text/css" />
</head>
<body>
<br />
<br />
    <form action="FileInsert.asp" method="POST" enctype="multipart/form-data" target="_self">
      <table width="39%" border="0" align="center" cellpadding="0" cellspacing="0" class="tblbodaPaul">
        <tr class="tblHeader1">
          <td height="40" colspan="2" class="tblHeader1a" scope="col"><strong>UPLOAD FILE TO SERVER </strong></td>
        </tr>
        <tr>
          <td width="98" height="40" class="TextLargerRight">File :&nbsp; </td>
          <td width="328" height="40" class="TextLargerLeft">&nbsp;&nbsp;
          <input name="file" type="file" class="TextNormalLeft" size="40" /></td>
        </tr>
        <tr class="tblHeader1">
          <td height="40" colspan="2" class="tdRowCenter"><input type="submit" class="tdSubmit1" value="Submit" /></td>
        </tr>
      </table>
</form>
</body>
</html>
3. FILE UPLOAD CONFIRMATION PAGE

Code:
<html>
<head>
	<title>File Uploading with ASP</title>
	<style>
		body, input, td { font-family:verdana,arial; font-size:10px; }
	body {
	margin-left: 0px;
	margin-top: 0px;
}
    .style4 {
	font-size: 10pt;
	font-weight: bold;
}
    </style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<br />
<br />
	<p align="center" class="style4">	File Uploaded to Server </p>
		<table width="60%" border="1" align="center">
	<tr>
		[COLOR=red][b]<td width="142">File Name</td>
		<td width="388">tdx_frontpage2.png</td>[/b][/color]
	</tr><tr>
		<td>File Path</td><td>C:\Documents and Settings\Me\Desktop\</td>
	</tr><tr>
		<td>File Path Complete</td><td>C:\Documents and Settings\Me\Desktop\tdx_frontpage2.png</td>
	</tr><tr>
		<td>File Size</td><td>85014</td>
	</tr><tr>
		<td>File Size Translated</td><td>83.02 kilobytes</td>
	</tr><tr>
		<td>Content Type</td><td>image/x-png</td>
	</tr><tr>
		<td>No. of Form Elements</td><td>1</td>
	</tr><tr>
		<td>Name</td><td></td>
	</tr>
</table><br><br>
	
	<p style="padding-left:220;">
	tdx_frontpage2.png data uploaded...
	</p>
	
</body>
</html>
As you will see from the upload confirmation page I have the filename in a field and all I need is to know how to insert that into the correct textfield on the record insert page.

Any help with this is much appreciated

Regards

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top