All pastes #63321 Raw Edit

Untitled

public text v1 · immutable
#63321 ·published 2006-06-09 12:55 UTC
rendered paste body
##########HTML PAGE##################
<html>
<head>
<title>File Upload Form</title>
</head>
<body>
This form allows you to upload a file to the server.<br>

<form action="scriptsubmission.php" method="post"><br>
<table>
<td>Script Name</td>
<td align="right"><div align="left">
  <input type="text" name="scriptname" size="12" maxlength="30">
</div></td>
</tr>
<tr>
<td>Version Number</td>
<td align="right"><div align="left">
  <input type="text" name="scriptver" size="3" maxlength="5">
</div></td>
</tr>
<tr>
<td height="85">Description</td>
<td align="right"><div align="left">
  <textarea name="scriptdescription" rows="3"
columns="12" maxlength="72"></textarea>
</div></td>
</tr>
<tr>
  <td height="85">Type (or select) Filename:    </td>
  <td align="right"><div align="left">
    <input type="file" name="uploadFile">
  </div></td>
</tr>
<tr>
  <td height="85">&nbsp;</td>
  <td align="right"><div align="left">
    <input name="submit" type="submit" value="Upload File">
  </div></td>
</tr>

</table>
<p align="center">&nbsp;</p>
<input type="hidden" name="MAX_FILE_SIZE" value="255997.5" />
</form>


</body>
</html>

#############PHP PAGE########################

<html>
<head>
<title>Script Submission</title>
</head>
<body style="font-family: Arial">
<h1><br>
order</h1>
<p> </p>

<?php
//This section displays the inputted data
$name = $_POST['scriptname'];
$ver = $_POST['scriptver'];
$desc = $_POST['scriptdescription'];
$file = $_POST['uploadfile'];
 echo "Name: ".$name." <br />\n";
echo "Version:".$ver." <br />\n";
echo "Description:".$desc." <br />\";
echo "File Uploaded:".$file." <br />\";
?>


<?php
//this actually uploads the file to /uploads/
if ( move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'],
       "../uploads/{$_FILES['uploadFile'] ['name']}")  )
      {  print '<p> The file has been successfully uploaded </p>';
       }
else
      {
        switch ($_FILES['uploadFile'] ['error'])
         {  case 1:
                   print '<p> The file is bigger than this PHP installation allows</p>';
                   break;
            case 2:
                   print '<p> The file is bigger than this form allows</p>';
                   break;
            case 3:
                   print '<p> Only part of the file was uploaded</p>';
                   break;
            case 4:
                   print '<p> No file was uploaded</p>';
                   break;
         }
       }
?>
</body>
</html>