πŸ“‚ Building a Simple File Management System with PHP & MySQL πŸš€

Ashish prajapati - Oct 28 - - Dev Community

Hello, Dev Community! πŸ‘‹

Today, I want to share with you my journey of creating a File Management System using PHP and MySQL. This project is a great way to learn about file uploads, database interactions, and overall web application development. Let’s dive in! 🌊

Image description

🌟 Project Overview

The File Management System allows users to:

  • Upload files πŸ“€
  • View uploaded files πŸ“œ
  • Update file details ✏️
  • Delete files πŸ—‘οΈ

It's a straightforward web application that can be used for various purposes, such as managing documents, images, or any other file types.

πŸ› οΈ Tech Stack

  • PHP: For server-side scripting
  • MySQL: To manage the database
  • Bootstrap: For responsive UI design
  • Font Awesome: For icons
  • HTML/CSS: For structuring and styling the web pages

πŸ’» Features

  • File Uploads: Users can easily upload files through a user-friendly interface.
  • File Management: View, update, and delete files as needed.
  • Privacy & Terms: Includes dedicated pages for privacy policy and terms of service to keep users informed.

πŸ“¦ File Structure

Here's a quick look at the file structure of the project:

file-management-system/
β”œβ”€β”€ delete.php           # Script to delete files
β”œβ”€β”€ index.php            # Home page
β”œβ”€β”€ privacy_policy.php   # Privacy policy page
β”œβ”€β”€ terms_of_service.php # Terms of service page
β”œβ”€β”€ update.php           # Update file details
β”œβ”€β”€ upload.php           # Handle file uploads
β”œβ”€β”€ uploads.sql         # SQL file for database setup
β”œβ”€β”€ upload_form.php      # File upload form
β”œβ”€β”€ view_files.php       # View uploaded files
β”œβ”€β”€ _Footer.php          # Footer component
β”œβ”€β”€ _Nav.php             # Navigation component
β”œβ”€β”€ conn.php             # Database connection file
Enter fullscreen mode Exit fullscreen mode

πŸ“– How It Works

  1. Uploading Files:
    • Users can select files from their local system and upload them.
    • The files are stored in a designated folder, and their paths are saved in the database.

Image description

  1. Viewing Files:
    • Users can see a list of uploaded files with options to download or delete them.

Image description

  1. Updating Files:
    • Users can edit file details, like changing the file name.

πŸ’‘ Getting Started

If you’re interested in trying it out, here’s how to set it up locally:

  1. Clone the repository:
   git clone https://github.com/Anticoder03/file-management.git
Enter fullscreen mode Exit fullscreen mode
  1. Navigate to the project folder:
   cd file-management-system
Enter fullscreen mode Exit fullscreen mode
  1. Import the SQL file to your MySQL database.
-- import uploads.sql
Enter fullscreen mode Exit fullscreen mode
  1. Configure the database connection in conn.php.
<?php
// Database configuration
$servername = "localhost";//hostname
$username = "root"; //username
$password = ""; //password
$dbname = "file_management"; //databasename

// Create a new MySQLi connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check the connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} else {
    // echo "Connected successfully!";
}
?>

Enter fullscreen mode Exit fullscreen mode
  1. Run the application in your web browser:
   http://localhost/file-management/index.php
Enter fullscreen mode Exit fullscreen mode

πŸŽ‰ Conclusion

Creating this File Management System was a rewarding experience that allowed me to solidify my understanding of PHP and MySQL. I encourage you to try building your own projects and share your experiences with the community!

Feel free to check out the project on GitHub and let me know your thoughts! πŸ’¬


πŸ€” What’s Next?

I plan to enhance this project by adding user authentication and more advanced file management features. Stay tuned for updates! πŸ””


Thank you for reading! If you found this post helpful, give it a πŸ‘ and share your thoughts in the comments below! Happy coding! πŸ‘¨β€πŸ’»πŸ‘©β€πŸ’»


. . . . . . . . . . . . . . . . . . . . . . .