Archive for VTW 
 


       VTW Forum Index -> HTML
computergeek67

Create a Simple Form

Forms are the fastest and easiest way to add interactivity to your site. I am going to teach you how to build a simple submit form. Paste this code:
Code:
<html>
<head>
<title>File Uploading Form</title>
</head>
<body>
<h3>File Upload:</h3>
Select a file to upload: <br />
<form action="/php/file_uploader.php" method="post"
                        endtype="multipart/form-data">
<input type="file" name="file" size="50" />
<br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>

You will notice that it links to an external PHP file called "file_uploader.php". This is what file_uploader.php lookes like:
Code:
<?php
if( $_FILES['file']['name'] != "" )
{
   copy( $_FILES['file']['name'], "/var/www/html" ) or
           die( "Could not copy file!");
}
else
{
    die("No file specified!");
}
?>
<html>
<head>
<title>Uploading Complete</title>
</head>
<body>
<h2>Uploaded File Info:</h2>
<ul>
<li>Sent file: <?php echo $_FILES['file']['name'];  ?>
<li>File size: <?php echo $_FILES['file']['size'];  ?> bytes
<li>File type: <?php echo $_FILES['file']['type'];  ?>
</ul>
</body>
</html>

Now when you upload a file, you should get the following result:
Uploaded File Info:

  • Sent file: uploadedfile.txt
  • File size: 2003 bytes
  • File type: image/jpg

-Tutorialspoint.com
evanescence

ooh far too complicated for me lol!!!!

       VTW Forum Index -> HTML
Page 1 of 1
Create your own free forum | Buy a domain to use with your forum