Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

FileUpload form

The form property is used to reference the form object that contains the FileUpload box. <html>     <head>     <title>Using FileUpload form property</title>     </head>     <body>     <script language="JavaScript">     <!--     function checkFiles(){          if (document.secret.file1.value == ""){              alert("You did not enter anything for file 1");          }          if (document.secret.file2.value == ""){              alert("You did not enter anything for file 2");          }          else {               alert("The files are okay and will be uploaded");          }     }     -->     </script>     <form name="secret">     Please choose two files to upload.     <br><br>     File 1:<input type="file" name="file1">     <br><br>     File 2:<input type="file" name="file2">     <br><br>     <input type="button" value="Verify" onClick='checkFiles()'>     </form>     </body>     </html>