Web Site Creator Web Hosting Help
   Uploading files using PHP

The following example demonstrates how to use PHP to transfer files to the server using only a web page.  This code can be modified to allow multiple files as well.

$file_dir = "uploadedfiles/"; //PUT A REAL DIRECTORY HERE
$page_name = "index.php"; //PUT THE ACTUAL NAME OF THE FILE HERE

$action = $HTTP_POST_VARS['action'];
if($action == 'upload'){
foreach($_FILES as $file_name => $file_array) {

if (is_uploaded_file($file_array['tmp_name'])) {
move_uploaded_file($file_array['tmp_name'], "$file_dir/$file_array[name]") or die ("Couldn't copy");
echo "file " . $file_array['name'] . " was moved to $file_dir !<br><br>";

<title>A simple file upload form</title>
<form enctype="multipart/form-data" method="POST" ID="Form1" action="<?= $page_name;?>">
<input type="hidden" name="MAX_FILE_SIZE" value="51200" ID="Hidden1">
<input type="hidden" name="action" value="upload" ID="Hidden2">
<p><strong>File to Upload:</strong>
<input type="file" name="fileupload" ID="File1"></p>
<p><input type="submit" value="upload!" ID="Submit1" NAME="Submit1"></p>



Sign Up Now! Overview

Questions? Call sales at
1 (425) 974-4688
Or try our
Visit our Help Center where you can get simple and quick product support.
bulkregister.com   is an affiliate of   , a leading domain name services company.
Copyright © 1999-2019 BulkRegister. All rights reserved. Terms & Conditions | Privacy Policy | Abuse Policy