Skip to main content

Simple File Manager Web App using PHP and MySQL Database Free Source Code

Language

In this article, I will be sharing with you a simple Web Application called File Manager Web App. This mini-project was developed using PHP and MySQL Database. The application is able to store/Upload, retrieve, download, and delete files. In this project source code, you will learn how to manage file uploads using PHP Language. I am sharing this source code because I think this will be useful for your future project and to enhance your programming capabilities.

The File Manage Web App has simple features that are all related to the uploaded file. All the uploaded files are listed/displayed in a table that has a filter, sorting, and pagination feature using the DataTable library. In here, the application user can simply upload the file by choosing the file that he/she desired to upload and by clicking the Submit button, the file will be uploaded into the server and will be enlisted on the table. The user can download the file by clicking the attachement/paper clip icon and delete the file by clicking the trashcan icon.

Features

  • Upload any file
  • List the Files in the Table
  • Download your File uploaded
  • Delete your File uploaded
  • Table Pagination
  • Table row filtering
  • Table column ordering/sorting

Here's the a sample source code that I used on this simple Web Application

This PHP source code contains INSERT Statement to save the data into the database.

  1. <?php
  2. $conn=new PDO('mysql:host=localhost; dbname=myweb', 'root', '') or die(mysql_error());
  3. if(isset($_POST['submit'])!=""){
  4. $name=$_FILES['photo']['name'];
  5. $size=$_FILES['photo']['size'];
  6. $type=$_FILES['photo']['type'];
  7. $temp=$_FILES['photo']['tmp_name'];
  8. $date = date('Y-m-d H:i:s');
  9. $caption1=$_POST['caption'];
  10. $link=$_POST['link'];
  11.  
  12. move_uploaded_file($temp,"files/".$name);
  13.  
  14. $query=$conn->query("INSERT INTO upload (name,date) VALUES ('$name','$date')");
  15. if($query){
  16. header("location:index.php");
  17. }
  18. else{
  19. }
  20. }
  21. ?>

The File Manager Web Application's Source Code is free to download on this website. Feel free to download and modify it the way you wanted.

How to Run ??

Requirements

  • Download and Install any local web server such as XAMPP/WAMP.
  • Download the provided source code zip file. (download button is located below)

Installation/Setup

  1. Open your XAMPP/WAMP's Control Panel and start Apache and MySQL.
  2. Extract the downloaded source code zip file.
  3. If you are using XAMPP, copy the extracted source code folder and paste it into the XAMPP's "htdocs" directory. And If you are using WAMP, paste it into the "www" directory.
  4. Browse the PHPMyAdmin in a browser. i.e. http://localhost/phpmyadmin
  5. Create a new database naming myweb.
  6. Import the provided SQL file. The file is known as upload.sql located inside the SQL folder.
  7. Browse the Simple File Manager Web App in a browser. i.e. http://localhost/myfilemgr.

DEMO

That's it! You can now test the features and functionlities of this Simple File Manager Web App in PHP and MySQL Database. I hope this will help you with what you are looking for and for your future projects.

Happy Coding!!

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.

Comments

Submitted byhahaa (not verified)on Thu, 08/18/2016 - 22:43

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)' in E:\xampp\htdocs\uploaddelete\myfilemgr\index.php:15 Stack trace: #0 E:\xampp\htdocs\uploaddelete\myfilemgr\index.php(15): PDO->__construct('mysql:host=loca...', 'root', '155300') #1 {main} thrown in E:\xampp\htdocs\uploaddelete\myfilemgr\index.php on line 15

//$conn=new PDO('mysql:host=localhost; dbname=myweb', 'root', '155300') or die(mysql_error()); $servername = "localhost"; $username = "root"; $password = "155300"; $dbname = "myweb"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }
Submitted byZhafran (not verified)on Fri, 10/06/2017 - 10:45

Hello Ganeshrkt I have use your system for my work, now how can I give you some credit? Is it you give me to use your work?
Submitted byatiqah (not verified)on Mon, 10/16/2017 - 12:23

i got blank page when i execute the php file. Even the tittle didn't show up on my browser.

Submitted bytiqa (not verified)on Thu, 11/23/2017 - 16:30

Fatal error: Uncaught Error: Call to undefined function mysql_query() in C:\xampp\htdocs\uploaddelete\myfilemgr\index.php:125 Stack trace: #0 {main} thrown in C:\xampp\htdocs\uploaddelete\myfilemgr\index.php on line 125 i got this error whenever i try to access the page
Submitted byjohnkananaman (not verified)on Fri, 05/18/2018 - 10:35

Fatal error: Uncaught Error: Call to undefined function mysql_query() in C:\xampp\htdocs\frmdsystem\index.php:125 Stack trace: #0 {main} thrown in C:\xampp\htdocs\frmdsystem\index.php on line 125
Submitted bynaive code (not verified)on Thu, 05/24/2018 - 11:54

thank you so much for the system
Submitted bySyah Na'im (not verified)on Wed, 10/03/2018 - 12:47

Thanks for coding. But I am got blank page after upload the file. Even upload was done but no data record in SQL. Please FIX it!
Submitted byRonbo (not verified)on Wed, 10/07/2020 - 12:38

I downloaded and unzipped the zip file but I saw no install program or instructions for installing either here or in the package.

Add new comment