<!DOCTYPE html>
<html>
<!--
##############################################################################
# upload a file from an html form
# the upload directory MUST have permissions: drwx-wx-wx
# please specify below: name of an upload directory
# also: name of an optional redirect html page
##############################################################################
-->
<head>
<title>Upload a file</title>
</head>
<body bgcolor="lightyellow">
<h1>Upload your files - </h1>
<form name="form1" method="POST" enctype="multipart/form-data"
action="/~sultans/util/form/upload.cgi">
<fieldset style="border-color:gold; width:700px; background-color:#f9f9f9; border-radius:10px;">
<legend align="left">Enter Fields Below</legend>
<br>
<table>
<tr>
<td><b>Upload File ...</td>
<td><input type="file" name="filename" size="40" onChange="return validate()"> </td>
<tr height="10">
</tr>
<tr>
<td><b>To Directory ...</td>
<td><input type="text" name="destdir" size="40" value="/home/sultans/data/uploads/"> </td>
<tr height="10">
</tr>
<tr>
<td><b>Rename File ...</td>
<td><input type="text" name="newname" size="40"> [Optional] </td>
<tr height="10">
</tr>
<tr>
<td><input type="submit" value=" Upload " onClick="return validate()"> </td>
<td><input type="reset" value="Clear"> </td>
</tr>
</table>
<br><br>
</fieldset>
</form>
<script>
<!-- JavaScript code to validate the form entry fields -----------------------------
function validate() {
if (document.form1.filename.value == '') //--- validate file-1
{
alert('Please enter a file name !!!');
return(false);
}
if (document.form1.destdir.value == '') //--- validate upload directory
{
alert('Please enter a directory name !!!');
return(false);
}
}
//-->
</script>
</body>
</html>