Skip to content

Files Uploads project Updates

Latest

Choose a tag to compare

@mashunterbd mashunterbd released this 13 Aug 04:46
a74fe67
  1. Mobile and Desktop Display Adjustments:
    We'll improve the CSS to make the form responsive. This will ensure that the form looks good on both mobile devices and larger screens like laptops or desktops.

  2. File Name Sanitization:
    We'll refine the sanitize_filename function to properly handle hyphens, underscores, and other special characters so that file names are correctly sanitized without creating overly long sequences of unders
    cores.

Key Features of the Script:

Progress Bar: This script provides a progress bar for file uploads, giving real-time feedback to the user.


File Sanitization: The file names are sanitized to prevent any illegal characters from being used.

Some files get renamed when sanitizing files, If you want any file not to be sanitized, in case any file can be uploaded by users, we have provided another zip file to download and use it.

Automatic Directory Creation: The script will automatically create the uploads directory if it doesn't exist.

Error Reporting: If any errors occur, they are reported both visually and via error logs for easier debugging.

Cross-platform Accessibility: The script supports accessing the server via a QR code, making it easy to access the upload page from a mobile device or another computer on the same network.

To use the provided script for setting up a file upload system without file sanitization, follow these steps:

Prerequisites

  1. PHP Installed: Ensure that PHP is installed on your system.
  2. Network Connection: The script will identify your local IP address to create a file server.

Steps to Run the Script

  1. Create a Bash Script File:

    • Save the provided script in a file, e.g., file_upload.sh.
  2. Make the Script Executable:

    • Open your terminal.
    • Navigate to the directory where file_upload.sh is saved.
    • Run the following command to make the script executable:
      chmod +x file_upload.sh
  3. Run the Script:

    • Execute the script by running:
      ./file_upload.sh
  4. Server Setup:

    • The script will automatically create an index.html file and an upload.php file in the current directory.
    • It will then start a PHP server on an available port, using your local IP address or localhost if no network is detected.
  5. Access the Upload Page:

    • The script will display a QR code in the terminal. You can scan this with your mobile device to access the upload page directly.
    • Alternatively, open a web browser and navigate to the displayed URL (e.g., http://192.168.x.x:8080).
  6. Upload Files:

    • Use the file upload form to select and upload files.
    • The uploaded files will be stored in the uploads directory created in the same directory as the script.
  7. Stop the Server:

    • The script will wait for your input to stop the server. Press Enter or any key in the terminal to stop the server and clean up the generated files.

Important Notes

  • Security Warning: Since file sanitization is removed, this script allows the upload of any file, which could be a potential security risk if deployed on a public server.
  • Local Testing: This script is intended for local or controlled environments, not for public-facing websites without proper security measures.