How to Create Upload File

Submitted by: 
Visitors have accessed this post 2355 times.

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.

  1. <div class="row-fluid">
  3. <div class="span4">
  4. <!----- form ---->
  5. <form action="upload.php" method="post" enctype="multipart/form-data" name="upload">
  6. <label style="color:blue; font-size:18px; font-family:cursive;"> File </label>
  7. <input name="uploaded_file" type="file" class="input-xlarge" required/>
  8. <input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
  9. <label style="color:blue; font-size:18px; font-family:cursive;"> File Name </label>
  10. <input type="text" name="fname" required>
  11. <label style="color:blue; font-size:18px; font-family:cursive;"> Description </label>
  12. <textarea name="desc" cols="" rows="" class="input-xlarge" required></textarea>
  13. <br/>
  14. <input name="Upload" type="submit" value="Upload" class="btn btn-primary btn-large" />
  15. </form>
  16. <!---- end form -->
  17. </div>
  19. <div class="span8">
  21. <table class="table table-bordered">
  22. <tr>
  23. <th>File Name</th>
  24. <th>Description</th>
  25. <th>Date Upload</th>
  26. </tr>
  27. </thead>
  28. <?php $query=mysql_query("select * from up_files")or die(mysql_error());
  29. while($row=mysql_fetch_array($query)){
  30. ?>
  31. <tr>
  32. <td><?php echo $row['fname']; ?></td>
  33. <td><?php echo $row['fdesc']; ?></td>
  34. <td><?php echo date("M d, Y h:i:s A",strtotime($row['fdatein'])); ?></td>
  36. </tr>
  37. <?php } ?>
  38. </tbody>
  39. </table>
  40. </div>
  42. </div>

Let's try this one.

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.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.