PHP Classes

PHP File Uploading: Simple library to build your file sharing website

Recommend this page to a friend!
  Info   View files Example   View files View files (31)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-08 (4 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 109 This week: 14All time: 9,611 This week: 16Up
Version License PHP version Categories
phpfileuploading 1.0.1Custom (specified...7Files and Folders, PHP 7, PSR
Description 

Author

PHP Library to help you build your own file sharing website.

Picture of Faris AL-Otabi
  Performance   Level  
Name: Faris AL-Otabi <contact>
Classes: 12 packages by
Country: Saudi Arabia Saudi Arabia
Innovation award
Innovation award
Nominee: 3x

Recommendations

Example

<?php

include '../src/Upload.php';
include
'../src/File.php';
include
'../src/Utility.php';

use
Farisc0de\PhpFileUploading\File;
use
Farisc0de\PhpFileUploading\Upload;
use
Farisc0de\PhpFileUploading\Utility;

$upload = new Upload(new Utility());

$upload->setUploadFolder([
   
'folder_name' => 'uploads',
   
'folder_path' => realpath('uploads')
]);

$upload->enableProtection();

if (
$_SERVER['REQUEST_METHOD'] == 'POST') {
   
$file = new File($_FILES['file'], new Utility());

   
$upload->setUpload($file);

    if (
$upload->checkIfNotEmpty()) {
        if (!
$upload->checkForbidden()) {
            echo
"Forbidden name";
            exit;
        }

        if (!
$upload->checkExtension()) {
            echo
"Forbidden Extension";
            exit;
        }

        if (!
$upload->checkMime()) {
            echo
"Forbidden Mime";
            exit;
        }

        if (!
$upload->isImage()) {
            echo
"Not Image";
            exit;
        }

       
$upload->upload();

       
$data = json_decode($upload->getJSON(), true);
    }
}
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>File Uploading Service</title>
</head>

<body>
    <?php if (isset($data)) : ?>
<p>You file has been uploaded</p>
    <?php endif; ?>

    <form action="" method="post" enctype="multipart/form-data">
        <input type="file" name="file" id="file">
        <button type="submit">Upload</button>
    </form>

    <div>
        <ul>
            <?php if (isset($data)) : ?>
<li>Filename: <?= $data['filename']; ?></li>
                <li>Filehash: <?= $data['filehash']; ?></li>
                <li>Filesize: <?= $data['filesize']; ?></li>
                <li>Upload at: <?= $data['uploaddate']; ?></li>
            <?php endif; ?>
</ul>
    </div>
</body>

</html>


Details

PhpFileUploading

PHP Library to help you build your own file sharing website.

Features

  1. Simple to use and implement
  2. 4 Protection levels 1. Mime Type 2. Extensions 3. Size 4. Forbidden names
  3. Out Of The Box Functions
  4. Multi-File Upload Support

How to install

composer require farisc0de/phpfileuploading

How to Use

take a look at the documentation and the examples

TODO

Image Manipulation

License

MIT

Copyright

Developed by FarisCode


  Files folder image Files  
File Role Description
Files folder imagedocs (1 file, 9 directories)
Files folder imageexample (3 files)
Files folder imagesrc (5 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  docs  
File Role Description
Files folder imageclasses (1 file)
Files folder imagecss (3 files)
Files folder imagefiles (1 file)
Files folder imagegraphs (1 file)
Files folder imageindices (1 file)
Files folder imagejs (2 files)
Files folder imagenamespaces (3 files)
Files folder imagepackages (3 files)
Files folder imagereports (3 files)
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files  /  docs  /  classes  
File Role Description
  Accessible without login HTML file Farisc0de-PhpFileUploading-Upload.html Doc. Documentation

  Files folder image Files  /  docs  /  css  
File Role Description
  Accessible without login Plain text file base.css Data Auxiliary data
  Accessible without login Plain text file normalize.css Data Auxiliary data
  Accessible without login Plain text file template.css Data Auxiliary data

  Files folder image Files  /  docs  /  files  
File Role Description
  Accessible without login HTML file src-upload.html Doc. Documentation

  Files folder image Files  /  docs  /  graphs  
File Role Description
  Accessible without login HTML file classes.html Doc. Documentation

  Files folder image Files  /  docs  /  indices  
File Role Description
  Accessible without login HTML file files.html Doc. Documentation

  Files folder image Files  /  docs  /  js  
File Role Description
  Accessible without login Plain text file search.js Data Auxiliary data
  Accessible without login Plain text file searchIndex.js Data Auxiliary data

  Files folder image Files  /  docs  /  namespaces  
File Role Description
  Accessible without login HTML file default.html Doc. Documentation
  Accessible without login HTML file farisc0de-phpfileuploading.html Doc. Documentation
  Accessible without login HTML file farisc0de.html Doc. Documentation

  Files folder image Files  /  docs  /  packages  
File Role Description
  Accessible without login HTML file Application.html Doc. Documentation
  Accessible without login HTML file default.html Doc. Documentation
  Accessible without login HTML file PhpFileUploading.html Doc. Documentation

  Files folder image Files  /  docs  /  reports  
File Role Description
  Accessible without login HTML file deprecated.html Doc. Documentation
  Accessible without login HTML file errors.html Doc. Documentation
  Accessible without login HTML file markers.html Doc. Documentation

  Files folder image Files  /  example  
File Role Description
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login Plain text file indexMulti.php Example Example script
  Accessible without login Plain text file indexSingle.php Example Example script

  Files folder image Files  /  src  
File Role Description
  Plain text file File.php Class Class source
  Accessible without login Plain text file filter.json Data Auxiliary data
  Plain text file Image.php Class Class source
  Plain text file Upload.php Class Class source
  Plain text file Utility.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:109
This week:14
All time:9,611
This week:16Up