This project implements a file upload system with support for large file uploads (up to 3GB), file management (deletion, folder creation), and a simple database integration for tracking uploaded files. The system uses PHP for server-side logic and MySQL for database operations.
- Large File Upload Support: Supports uploads of files up to 3GB.
- Folder Management: Create and delete folders.
- File Management: Upload, delete, and preview files.
- Database Integration: Stores file metadata (e.g., filename, original name, folder, MIME type) in a MySQL database.
- Progress Tracking: Real-time upload progress using AJAX.
- File Previews: Supports previews for images and videos.
- Web Server: Apache with PHP enabled.
- Database: MySQL.
- PHP Configuration: Adjust PHP settings for large uploads.
Ensure the following PHP settings are configured in your php.ini or .htaccess file:
php_value upload_max_filesize 3072M
php_value post_max_size 3072M
php_value memory_limit 4096M
php_value max_execution_time 3600
php_value max_input_time 3600Create a MySQL database and configure the following settings in your PHP files:
| Parameter | Default Value |
|---|---|
| Host | localhost |
| Username | root |
| Password | '' |
| Database Name | file_upload_db |
Run the provided index.php file, which will create the database and files table automatically.
Ensure your project has the following directory structure:
project-root/
|-- uploads/ # Directory for storing uploaded files
|-- upload.php # Handles file uploads
|-- delete.php # Handles file and folder deletion
|-- index.php # Main interface and database initialization
|-- .htaccess # PHP and Apache settings
|-- README.md # Project documentation
Ensure the uploads/ directory has write permissions:
chmod -R 777 uploads/Access the application via your browser:
http://localhost/project-root/index.php
- Use the "Create New Folder" form to add new folders under the
uploads/directory.
- Select a file and target folder using the upload form.
- Upload progress will be displayed in real-time.
- Delete Files: Use the delete button next to a file.
- Delete Folders: Use the delete button for folders (deletes all contents).
- Preview Files: Images and videos can be previewed directly in the browser.
- Path Validation: The system validates all file and folder paths to prevent directory traversal attacks.
- Input Sanitization: User inputs are sanitized using
htmlspecialcharsto prevent XSS attacks. - Database Protection: Prepared statements are used to prevent SQL injection.
- The system supports only standard file formats for preview (e.g., images and videos).
- The file size limit is 3GB but can be adjusted based on server capabilities.
- Uploads Failing: Ensure PHP and Apache settings match the recommended values.
- Database Errors: Verify your MySQL connection settings in the PHP files.
- Permission Issues: Check
uploads/directory permissions.
This project is licensed under the MIT License.
This system uses the following libraries and tools:
- Bootstrap: For UI styling.
- Font Awesome: For icons.
- AJAX: For real-time upload progress.