Previously in our script
allowing files to be uploaded from the browser and saved to the hosting via PHP, we mentioned it was possible to rename the files to something random to prevent people uploading files with the same name and overwriting each other's files. In this script we will explore that further.
<form enctype="multipart/form-data" action="upload.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
The first thing we must do, is allow the user to upload a file. We can do that by placing this HTML on any page we want to allow them to upload from. This code is in a file separate from our PHP. It points to a file called upload.php, however if you save your PHP by a different name you should change it here.