In this article, we are going to learn how to create Upload File. This simple Upload File the users enable to upload any kind of files and save into the database table.
Creating one file upload for the files that we are going to upload, one TextBox for the file name, and one TextArea for the file description as shown in the image below.
Here's the simple source code to create as shown in the image above.
- <div class="row-fluid">
- <div class="span4">
- <!----- form ---->
- <form action="upload.php" method="post" enctype="multipart/form-data" name="upload">
- <input name="uploaded_file" type="file" class="input-xlarge" required/>
- <input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
- <input type="text" name="fname" required>
- <input name="Upload" type="submit" value="Upload" class="btn btn-primary btn-large" />
- <!---- end form -->
- <div class="span8">
- <table class="table table-bordered">
- <?php $query=mysql_query("select * from up_files")or die(mysql_error());
- <?php } ?>
We are going to select a file that we are going to upload, enter the file name, and enter the file description as shown in the image below.
After that, we are going to click the "Upload" button to save into the database table as you can see in the image below.
Kindly click the "Download Code" button below for full source code. Thank you very much.
Hope that this tutorial will help you a lot.
Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.