Get/Post selected Filename

I’m using some of my code and WYSIWYG Web builder for my pages.

What I’m trying to do.

I fill out a form and then also select a file on my system using the file upload.

But I don’t want the file to be uploaded. I only want the file name selected to be sent
when click submit. Since I will be dealing with large files and large numbers of files I
already have a page that will use FTP that allows to select the whole directory and
upload the files.

If there is an easier way to have the same basic function, would be great. My searches
the last few days are not doing so well.

Here is an example of the code Web Builder has for the file select.


<input type="file" id="FileUpload6" style="position:absolute;left:429px;top:514px;width:218px;height:21px;font-family:Arial;font-size:13px;z-index:27" name="B2-File">

I don’t know if this is even possible, but I’m hoping it is. A page could have many files that the file names would have to be typed in all the time.

Thanks
Bob

Well, not exactly sure what you want. But, the filename of an input type=file is easy to read.
Your sample line has assigned the NAME of the input as “B2-File”. (Note the caps must match your code!)

This PHP line will read the name only of that input field:
[php]
$filename=$_FILES[‘B2-File’][‘name’];
[/php]

To explain that line, FILES that are created on a form using input fields are placed into a system array called “FILES” and sent to the posted file. Usually, this name is used to upload that file to the server. But, this is
what you want, I think… You can have a list of input fields, let’s say 10 files or more and then parse thru
the entire list of them with a for loop and loop thru all $_FILES[][‘name’] to get all 10 or more filenames.

Hope that helps… Good luck!

I have them all B1-File, B2-File etc.

Web Builder uploads the file selected in all fields, where in the code would I put your line so it only sends the the file name and not the file itself?.

Thanks for your reply and help. I can put more of the code up if you need me to.


<input type="file" id="FileUpload6" style="position:absolute;left:429px;top:514px;width:218px;height:21px;font-family:Arial;font-size:13px;z-index:27" name="B2-File">

So, now you are saying you have several files listed in your form. ( B1-File, B2-File, etc. )
And, you have a submit button that goes to some code…
(assumption without seeing more of your code!)

So, in your “post” or “submit” code, you do something? Most likely send the files to the server.
Change THAT code to use the $filename=$_FILES[‘B2-File’][‘name’]; commands and loop thru
the files $_FILES[][‘name’] and send those only.

If you want us to tell you how to do that, we would need to see your code for where the form is posted to.
(Hard to help without seeing the code!) But, hope that helps!

Not totally. This is so hard trying to type this out.

I want a click to select file name on hard drive and post the file name to the form. Like the file upload does but with out sending the file. Just the file name. I don’t want them to upload the files.

I have another page that will handle the files with FTP file upload.

I don’t know if there is any other way to select a file for just the name and submit it with the form is why I’m using the file upload as an example.

It’s hard trying to explain in typing since I don’t know enough about php programming.

I use WYSIWYG Web Builder from wysiwygwebbuilder.com
Here is the page code from the Web Builder software.

This page is limited to 20000 characters. The page code exceeds that. This is part 1, part two on the next one.

Part 1


<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
   if (isset($_POST['captcha_code'],$_SESSION['random_txt']) && md5($_POST['captcha_code']) == $_SESSION['random_txt'])
   {
      unset($_POST['captcha_code'],$_SESSION['random_txt']);
   }
   else
   {
      echo '<b>The entered code was wrong.</b><br>';
      echo '<a href="javascript:history.back()">Go Back</a>';
      exit;
   }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">
<title>Ross Services</title>
<meta name="generator" content="WYSIWYG Web Builder - http://www.wysiwygwebbuilder.com">
<style type="text/css">
div#container
{
   width: 804px;
   position: relative;
   margin-top: 0px;
   margin-left: auto;
   margin-right: auto;
   text-align: left;
}
</style>
<style type="text/css">
body
{
   text-align: center;
   margin: 0;
   background-color: #808080;
   background-image: url(images/_bkgrnd.png);
   color: #000000;
   scrollbar-face-color: #D4D0C8;
   scrollbar-arrow-color: #000000;
   scrollbar-3dlight-color: #D4D0C8;
   scrollbar-darkshadow-color: #404040;
   scrollbar-highlight-color: #FFFFFF;
   scrollbar-shadow-color: #808080;
   scrollbar-track-color: #D4D0C8;
}
</style>
<style type="text/css">
h5
{
   font-family: Arial;
   font-size: 19px;
   font-weight: normal;
   font-style: normal;
   text-decoration: none;
   color: #000000;
   margin: 0 0 0 0;
   padding: 0 0 0 0;
   display: inline;
}

</style>
<style type="text/css">
#NavigationBar1 ul.navbar
{
   list-style: none;
   margin: 0;
   padding: 0;
}
#NavigationBar1 ul.navbar li
{
   height: 25px;
   width: 160px;
   float: left;
   margin: 0px 4px 0px 0px;
}
#NavigationBar1 ul.navbar li a
{
   display: block;
   position: relative;
}
#NavigationBar1 ul.navbar li a img
{
   position: absolute;
   z-index: 1;
   border-width: 0px;
}
#NavigationBar1 ul.navbar li span
{
   display: block;
   height: 25px;
   width: 160px;
   position: absolute;
   z-index: 2;
}
</style>
<script type="text/javascript">
<!--
function ValidateForm1(theForm)
{
   var regexp;
   var extension = theForm.FileUpload6.value.substr(theForm.FileUpload6.value.lastIndexOf('.'));
   if ((extension.toLowerCase() != ".avi") &&
       (extension.toLowerCase() != ".doc") &&
       (extension.toLowerCase() != ".gif") &&
       (extension.toLowerCase() != ".jpg") &&
       (extension.toLowerCase() != ".mov") &&
       (extension.toLowerCase() != ".mp3") &&
       (extension.toLowerCase() != ".mp4") &&
       (extension.toLowerCase() != ".mpeg") &&
       (extension.toLowerCase() != ".pdf") &&
       (extension.toLowerCase() != ".qt") &&
       (extension.toLowerCase() != ".rtf") &&
       (extension.toLowerCase() != ".xls") &&
       (extension != ""))
   {
      alert("The \"FileUpload6\" field contains an unapproved filename.");
      theForm.FileUpload6.focus();
      return false;
   }
   var extension = theForm.FileUpload2.value.substr(theForm.FileUpload2.value.lastIndexOf('.'));
   if ((extension.toLowerCase() != ".avi") &&
       (extension.toLowerCase() != ".doc") &&
       (extension.toLowerCase() != ".gif") &&
       (extension.toLowerCase() != ".jpg") &&
       (extension.toLowerCase() != ".mov") &&
       (extension.toLowerCase() != ".mp3") &&
       (extension.toLowerCase() != ".mp4") &&
       (extension.toLowerCase() != ".mpeg") &&
       (extension.toLowerCase() != ".pdf") &&
       (extension.toLowerCase() != ".qt") &&
       (extension.toLowerCase() != ".rtf") &&
       (extension.toLowerCase() != ".xls") &&
       (extension != ""))
   {
      alert("The \"FileUpload6\" field contains an unapproved filename.");
      theForm.FileUpload2.focus();
      return false;
   }
   var extension = theForm.FileUpload3.value.substr(theForm.FileUpload3.value.lastIndexOf('.'));
   if ((extension.toLowerCase() != ".avi") &&
       (extension.toLowerCase() != ".doc") &&
       (extension.toLowerCase() != ".gif") &&
       (extension.toLowerCase() != ".jpg") &&
       (extension.toLowerCase() != ".mov") &&
       (extension.toLowerCase() != ".mp3") &&
       (extension.toLowerCase() != ".mp4") &&
       (extension.toLowerCase() != ".mpeg") &&
       (extension.toLowerCase() != ".pdf") &&
       (extension.toLowerCase() != ".qt") &&
       (extension.toLowerCase() != ".rtf") &&
       (extension.toLowerCase() != ".xls") &&
       (extension != ""))
   {
      alert("The \"FileUpload6\" field contains an unapproved filename.");
      theForm.FileUpload3.focus();
      return false;
   }
   var extension = theForm.FileUpload1.value.substr(theForm.FileUpload1.value.lastIndexOf('.'));
   if ((extension.toLowerCase() != ".avi") &&
       (extension.toLowerCase() != ".doc") &&
       (extension.toLowerCase() != ".gif") &&
       (extension.toLowerCase() != ".jpg") &&
       (extension.toLowerCase() != ".mov") &&
       (extension.toLowerCase() != ".mp3") &&
       (extension.toLowerCase() != ".mp4") &&
       (extension.toLowerCase() != ".mpeg") &&
       (extension.toLowerCase() != ".pdf") &&
       (extension.toLowerCase() != ".qt") &&
       (extension.toLowerCase() != ".rtf") &&
       (extension.toLowerCase() != ".xls") &&
       (extension != ""))
   {
      alert("The \"FileUpload6\" field contains an unapproved filename.");
      theForm.FileUpload1.focus();
      return false;
   }
   var extension = theForm.FileUpload5.value.substr(theForm.FileUpload5.value.lastIndexOf('.'));
   if ((extension.toLowerCase() != ".gif") &&
       (extension.toLowerCase() != ".jpg") &&
       (extension != ""))
   {
      alert("The \"FileUpload5\" field contains an unapproved filename.");
      theForm.FileUpload5.focus();
      return false;
   }
   return true;
}
//-->

Part 2


</script>
</head>
<body>
<div id="container">
<div id="wb_" style="margin:0;padding:0;position:absolute;left:0px;top:0px;width:800px;height:150px;text-align:left;z-index:35;">
<img src="images/img0167.gif" id="" alt="" title="" style="border-width:0;width:800px;height:150px"></div>
<div id="wb_" style="margin:0;padding:0;position:absolute;left:1px;top:36px;width:761px;height:114px;text-align:left;z-index:36;">
<img src="images/img0168.gif" id="" alt="" title="" style="border-width:0;width:761px;height:114px"></div>
<div id="wb_" style="margin:0;padding:0;position:absolute;left:135px;top:148px;width:666px;height:731px;text-align:left;z-index:37;">
<img src="images/img0169.gif" id="" alt="" title="" style="border-width:0;width:666px;height:731px"></div>
<div id="wb_" style="margin:0;padding:0;position:absolute;left:139px;top:132px;width:660px;height:112px;text-align:left;z-index:38;">
<img src="images/img0170.gif" id="" alt="" title="" style="border-width:0;width:660px;height:112px"></div>
<div id="wb_" style="margin:0;padding:0;position:absolute;left:3px;top:75px;width:138px;height:806px;text-align:left;z-index:39;">
<img src="images/img0171.gif" id="" alt="" title="" style="border-width:0;width:138px;height:806px"></div>
<div id="wb_" style="margin:0;padding:0;position:absolute;left:142px;top:858px;width:658px;height:21px;text-align:left;z-index:40;">
<img src="images/img0172.gif" id="" alt="" title="" style="border-width:0;width:658px;height:21px"></div>
<div id="wb_" style="margin:0;padding:0;position:absolute;left:251px;top:862px;width:417px;height:13px;text-align:center;z-index:41;">
<font style="font-size:11px" color="#FFFFFF" face="Tahoma">Copyright © 2010 by &quot;Ross Services&quot;&nbsp; ·&nbsp; All Rights reserved</font></div>
<div id="wb_" style="margin:0;padding:0;position:absolute;left:139px;top:113px;width:662px;height:37px;text-align:left;z-index:42;">
<img src="images/img0173.gif" id="" alt="" title="" style="border-width:0;width:662px;height:37px"></div>
<div id="wb_" style="margin:0;padding:0;position:absolute;left:161px;top:37px;width:226px;height:39px;text-align:left;z-index:43;">
<font style="font-size:32px" color="#000000" face="Tahoma"><b>Ross Services</b></font></div>
<div id="wb_" style="margin:0;padding:0;position:absolute;left:159px;top:33px;width:227px;height:39px;text-align:left;z-index:44;">
<font style="font-size:32px" color="#F1B150" face="Tahoma"><b>Ross Services</b></font></div>
<div id="wb_Text2" style="margin:0;padding:0;position:absolute;left:214px;top:78px;width:520px;height:25px;text-align:left;z-index:45;">
<font style="font-size:21px" color="#000000" face="Tahoma"><b>CD/DVD Duplicate &amp; Print w/Premium Auto-Run</b></font></div>
<div id="wb_Text1" style="margin:0;padding:0;position:absolute;left:215px;top:74px;width:510px;height:25px;text-align:left;z-index:46;">
<font style="font-size:21px" color="#F1B150" face="Tahoma"><b>CD/DVD Duplicate &amp; Print w/Primium Auto-Run</b></font></div>
<div id="NavigationBar1" style="position:absolute;left:144px;top:118px;width:656px;height:25px;z-index:47">
<ul class="navbar">
<li><a href="./index.html"><img alt="" src="images/img0174.gif"></a></li>
<li><a href="./contact.php"><img alt="" src="images/img0175.gif"></a></li>
<li><a href="./mc_parts.php"><img alt="" src="images/img0176.gif"></a></li>
<li><a href="./electronics.html"><img alt="" src="images/img0177.gif"></a></li>
</ul>
</div>
<div id="wb_Text6" style="margin:0;padding:0;position:absolute;left:428px;top:44px;width:318px;height:22px;text-align:left;z-index:48;">
<font style="font-size:19px" color="#FF9900" face="Arial"><b>(661) 836-5768 9am-6pm Mon-Sat</b></font></div>
<div id="wb_Form1" style="position:absolute;background-color:#FFFFFF;background-image:url(images/Auto-Run%20Basic-3.jpg);background-repeat:no-repeat;;background-position:left top;left:70px;top:90px;width:739px;height:786px;z-index:49">
<form name="Form1" method="post" action="http://192.168.4.4/cgi-bin/GenerateUploadInformation.cgi" enctype="text/plain" id="Form1" onsubmit="return ValidateForm1(this)">
<input type="hidden" name="B1-FileName" value="">
<div id="wb_Text3" style="margin:0;padding:0;position:absolute;left:423px;top:40px;width:99px;height:16px;text-align:left;z-index:0;">
<font style="font-size:13px" color="#000000" face="Arial">Name:</font></div>
<input type="text" id="Editbox1" style="position:absolute;left:520px;top:37px;width:198px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:1" name="Name:" value="">
<div id="wb_Text9" style="margin:0;padding:0;position:absolute;left:423px;top:67px;width:99px;height:16px;text-align:left;z-index:2;">
<font style="font-size:13px" color="#000000" face="Arial">eMail Address:</font></div>
<div id="wb_Text11" style="margin:0;padding:0;position:absolute;left:394px;top:119px;width:126px;height:16px;text-align:left;z-index:3;">
<font style="font-size:13px" color="#000000" face="Arial">AutoRun Menu Title:</font></div>
<input type="text" id="Editbox7" style="position:absolute;left:520px;top:117px;width:198px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:4" name="Editbox7" value="">
<input type="text" id="Editbox8" class="Heading 5 <h5>" style="position:absolute;left:13px;top:405px;width:200px;height:24px;z-index:5" name="B1-Name" value="    Button 1 Name" maxlength="20">
<input type="text" id="Editbox9" class="Heading 5 <h5>" style="position:absolute;left:13px;top:483px;width:200px;height:24px;z-index:6" name="B2-Name" value="    Button 2 Name" maxlength="20">
<input type="text" id="Editbox10" class="Heading 5 <h5>" style="position:absolute;left:13px;top:560px;width:200px;height:24px;z-index:7" name="B3-Name" value="    Button 3 Name" maxlength="20">
<input type="text" id="Editbox11" class="Heading 5 <h5>" style="position:absolute;left:13px;top:641px;width:200px;height:24px;z-index:8" name="B4-Name" value="    Button 4 Name" maxlength="20">
<div id="wb_Text16" style="margin:0;padding:0;position:absolute;left:372px;top:160px;width:320px;height:32px;text-align:left;z-index:9;">
<font style="font-size:13px" color="#000000" face="Arial">Menu Photo(Optional) Not Disk Label: (GIF,JPG Only)<br>
Enter File Name Here &amp; Select file to Upload</font></div>
<input type="text" id="Editbox12" style="position:absolute;left:221px;top:435px;width:198px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:10" name="B1-Web" value="  If Web Site Enter Link Here:">
<input type="text" id="Editbox13" style="position:absolute;left:221px;top:514px;width:198px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:11" name="B2-Web" value="  If Web Site Enter Link Here:">
<input type="text" id="Editbox14" style="position:absolute;left:221px;top:592px;width:198px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:12" name="B3-Web" value="  If Web Site Enter Link Here:">
<input type="text" id="Editbox15" style="position:absolute;left:221px;top:670px;width:198px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:13" name="B4-Web" value="  If Web Site Enter Link Here:">
<input type="submit" id="Button1" name="" value="Submit" style="position:absolute;left:379px;top:740px;width:139px;height:25px;font-family:Arial;font-size:13px;z-index:14">
<input type="reset" id="Button2" name="" value="Reset" style="position:absolute;left:552px;top:740px;width:96px;height:25px;font-family:Arial;font-size:13px;z-index:15">
<div style="position:absolute;left:221px;top:642px;width:198px;height:20px;border:1px #C0C0C0 solid;z-index:16">
<select name="B4-Click" size="1" id="Combobox4" style="position:absolute;left:0px;top:0px;width:100%;height:100%;border-width:0px;font-family:Arial;font-size:13px;">
<option selected>  Button 4 Select Goes to</option>
<option>Web Site - Enter Below</option>
<option>Open File  - Enter File Name & Upload---></option>
<option>Graphic  - Enter File Name & Upload---></option>
<option>Video  - Enter File Name & Upload---></option>
</select>
</div>
<div style="position:absolute;left:221px;top:563px;width:198px;height:20px;border:1px #C0C0C0 solid;z-index:17">
<select name="B3-Click" size="1" id="Combobox3" style="position:absolute;left:0px;top:0px;width:100%;height:100%;border-width:0px;font-family:Arial;font-size:13px;">
<option selected>  Button 3 Select Goes to</option>
<option>Web Site - Enter Below</option>
<option>Open File  - Enter File Name & Upload---></option>
<option>Graphic  - Enter File Name & Upload---></option>
<option>Video - Enter File Name & Upload---></option>
</select>
</div>
<div style="position:absolute;left:221px;top:485px;width:198px;height:20px;border:1px #C0C0C0 solid;z-index:18">
<select name="B2-Click" size="1" id="Combobox2" style="position:absolute;left:0px;top:0px;width:100%;height:100%;border-width:0px;font-family:Arial;font-size:13px;">
<option selected>  Button 2 Select Goes to</option>
<option>Web Site - Enter Below</option>
<option>Open File  - Enter File Name & Upload---></option>
<option>Graphic  - Enter File Name & Upload---></option>
<option>Video  - Enter File Name & Upload---></option>
</select>
</div>
<div style="position:absolute;left:221px;top:407px;width:198px;height:20px;border:1px #C0C0C0 solid;z-index:19">
<select name="B1-Click" size="1" id="Combobox1" style="position:absolute;left:0px;top:0px;width:100%;height:100%;border-width:0px;font-family:Arial;font-size:13px;">
<option selected>  Button 1 Select Goes to</option>
<option>Web Site - Enter Below</option>
<option>Open File - Enter File Name & Upload---></option>
<option>Graphic  -- Enter File Name & Upload---></option>
<option>Video  - Enter File Name & Upload---></option>
</select>
</div>
<div id="wb_Captcha2" style="margin:0;padding:0;position:absolute;left:152px;top:723px;width:198px;height:36px;text-align:left;z-index:20;">
<img src="captcha2.php" alt="Click for new image" title="Click for new image" style="cursor:pointer;width:100px;height:38px;" onclick="this.src='captcha2.php?'+Math.random()">
<input type="text" id="Captcha2Edit" style="position:absolute;left:105px;top:18px;width:98px;height:18px;border:1px #C0C0C0 solid;font-family:'Courier New';font-size:13px;" name="captcha_code" value=""></div>
<div id="wb_Text14" style="margin:0;padding:0;position:absolute;left:42px;top:719px;width:92px;height:16px;text-align:left;z-index:21;">
<font style="font-size:13px" color="#000000" face="Arial">Enter Captcha:</font></div>
<input type="text" id="Editbox17" style="position:absolute;left:429px;top:407px;width:198px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:22" name="B1-FileName" value="Enter File Name if uploaded">
<input type="text" id="Editbox16" style="position:absolute;left:429px;top:486px;width:198px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:23" name="B2-FileName" value="Enter File Name if uploaded">
<input type="text" id="Editbox18" style="position:absolute;left:429px;top:564px;width:198px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:24" name="B3-FileName" value="Enter File Name if uploaded">
<input type="text" id="Editbox19" style="position:absolute;left:429px;top:643px;width:198px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:25" name="B4-FileName" value="Enter File Name if uploaded">
<input type="text" id="Editbox20" style="position:absolute;left:520px;top:64px;width:198px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:26" name="eMail Address:" value="">
<input type="file" id="FileUpload6" style="position:absolute;left:429px;top:514px;width:218px;height:21px;font-family:Arial;font-size:13px;z-index:27" name="B2-File">
<input type="text" id="Editbox22" style="position:absolute;left:520px;top:197px;width:197px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;z-index:28" name="Menu Photo" value="File Name">
<input type="file" id="FileUpload2" style="position:absolute;left:429px;top:592px;width:214px;height:21px;font-family:Arial;font-size:13px;z-index:29" name="B3-File">
<input type="file" id="FileUpload3" style="position:absolute;left:429px;top:670px;width:218px;height:21px;font-family:Arial;font-size:13px;z-index:30" name="B4-File">
<div id="wb_Text12" style="margin:0;padding:0;position:absolute;left:168px;top:380px;width:501px;height:16px;text-align:left;z-index:31;">
<font style="font-size:13px" color="#CC3300" face="Arial">AVI, QT, MOV, MP4, MP3, DOC, RTF, XLS, MPEG, GIF, JPG, PDF - File types only</font></div>
<input type="file" id="FileUpload1" style="position:absolute;left:429px;top:435px;width:218px;height:21px;font-family:Arial;font-size:13px;z-index:32" name="B1-File">
<div id="wb_Text4" style="margin:0;padding:0;position:absolute;left:398px;top:9px;width:331px;height:16px;text-align:left;z-index:33;">
<font style="font-size:13px" color="#000000" face="Arial">We use your name and eMail to combine Menu Choices </font></div>
<input type="file" id="FileUpload5" style="position:absolute;left:520px;top:224px;width:199px;height:20px;font-family:Arial;font-size:13px;z-index:34" name="Menu Photo">
</form>
</div>
</div>
</body>
</html>

Again:

I want a click to select file name on hard drive and post the file name to the form. Like the file upload does but with out sending the file. Just the file name. I don't want them to upload the files.

This is done the way I mentioned. You use a
This creates a form field to allow inputting a FILENAME. It does NOT upload a file.
The actual uploading of a file is handled in YOUR code, not anything to do with the form code.
Your code would just steal the name from the field and NOT send the file. Then, you pass the
filename however you want to. Such as save into a database or text file or email. Whatever…

So, let’s say there are 10 file fields on your form. You would read all of the names that the user
browsed to. This will give you a list of filenames. You save them to a database. Then, your ftp app
would read the files in the “to-be-downloaded” database table and upload them for you and delete
the entries in the database after each was uploaded. Something like that.

Remember, an “input” field “type” FILE does nothing but allow a user to give you a file name on their
system. Then, YOUR code handles what to do with this filename. Hope that made sense!

Ok, great. Your code will give a browse button to select the file and not enter it in?

Thanks
Bob

Yes, it should. The real upload part is in your PHP code, not the html!

Good luck and let us know if you get stuck…

With the line of code in there now where do I out yours or does it go at the top of the file at the start?

I have a choice of either editing the file or auto placing it

Start of Page
Between <head. tags
Inside tag
After tag
Before tag
End of Page


<input type="file" id="FileUpload6" style="position:absolute;left:429px;top:514px;width:218px;height:21px;font-family:Arial;font-size:13px;z-index:27" name="B2-File">

It’s trying to upload the file.

I can’t tell where in the code it’s doing that from, but they have the file upload as part of a selection in the form creation wizard.

I’m not sure where I should but your code. Will this stop the submit from trying to upload the file?


$filename=$_FILES['B2-File']['name'];

I got this working.

Just needed to remove enctype=“multipart/form-data” and it will send the name and not the file.

You still need to setup the param in the cgi file it submits to. But that’s easy enough.

Thanks for your help.
Bob

Well, you showed us your Javascript validation code and your HTML/STYLE code for your form.
We never saw the PHP code that the JS/HTML is sent to. But, hopefully, you got is all working.

If so, glad to hear that you solved it. If not, let us know if you need further help with it.

The hole page I submitted is split in two postings. Part 1 - Part 2, I don’t think there is any Java in it. I never selected that in the web builder. It was suppose to be all PHP coding.

Someone mentioned find enctype=“multipart/form-data” and remove it. It was in Part 2. Didn’t have to change anything in the cgi script but add the B1-FileName param to work with it.


<form name="Form1" method="post" action="http://192.168.4.4/cgi-bin/GenerateUploadInformation.cgi" enctype="text/plain" id="Form1" onsubmit="return ValidateForm1(this)">
<input type="hidden" name="B1-FileName" value="">

I was letting any on this forum that might have been following or those that search in the future how to do if if they ever need to do the same. It’s a real easy fix.

Congrats on the fix.

By-the-way… this code “ValidateForm1(this)” is javascript. Also, about one half of your part 1 post was all javascript. Any sections with tags of in your code was javascript.

The part you didn’t show us was here: cgi-bin/GenerateUploadInformation.cgi This is the code that is called
by your routine. That is what I thought I needed to see, but, obviously, I was wrong.

Thanks for posting the solution, am sure it will be helpful for some one searching the site!

Ah, ok. I didn’t know.

Thanks

Sponsor our Newsletter | Privacy Policy | Terms of Service