Coder Social home page Coder Social logo

alasysys / php-uploader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from creativedream/php-uploader

0.0 0.0 0.0 20 KB

PHP File Uploader is an easy to use, hi-performance File Upload Script which allows you to upload files to webserver

License: MIT License

PHP 100.00%

php-uploader's Introduction

[PHP] Uploader 0.4

PHP File Uploader is an easy to use, hi-performance File Upload Script which allows you to upload/download files to webserver

Demo | Documentation | Fileuploader

Usage

Upload:

include('src/class.uploader.php');

$uploader = new Uploader();
$data = $uploader->upload($_FILES['files'], array(
    'limit' => 10, //Maximum Limit of files. {null, Number}
    'maxSize' => 10, //Maximum Size of files {null, Number(in MB's)}
    'extensions' => null, //Whitelist for file extension. {null, Array(ex: array('jpg', 'png'))}
    'required' => false, //Minimum one file is required for upload {Boolean}
    'uploadDir' => 'uploads/', //Upload directory {String}
    'title' => array('auto', 10), //New file name {null, String, Array} *please read documentation in README.md
    'removeFiles' => true, //Enable file exclusion {Boolean(extra for jQuery.filer), String($_POST field name containing json data with file names)}
    'replace' => false, //Replace the file if it already exists {Boolean}
    'perms' => null, //Uploaded file permisions {null, Number}
    'onCheck' => null, //A callback function name to be called by checking a file for errors (must return an array) | ($file) | Callback
    'onError' => null, //A callback function name to be called if an error occured (must return an array) | ($errors, $file) | Callback
    'onSuccess' => null, //A callback function name to be called if all files were successfully uploaded | ($files, $metas) | Callback
    'onUpload' => null, //A callback function name to be called if all files were successfully uploaded (must return an array) | ($file) | Callback
    'onComplete' => null, //A callback function name to be called when upload is complete | ($file) | Callback
    'onRemove' => 'onFilesRemoveCallback' //A callback function name to be called by removing files (must return an array) | ($removed_files) | Callback
));

if($data['isComplete']){
    $files = $data['data'];
    print_r($files);
}

if($data['hasErrors']){
    $errors = $data['errors'];
    print_r($errors);
}

Download:

include('src/class.uploader.php');

$uploader = new Uploader();
$data = $uploader->upload('https://www.google.com/images/srpr/logo11w.png', array(
    'uploadDir' => 'uploads/', //Upload directory {String}
    'title' => array('auto', 10), //New file name {null, String, Array} *please read documentation in README.md
));

if($data['isComplete']){
    $files = $data['data'];
    print_r($files);
}

if($data['hasErrors']){
    $errors = $data['errors'];
    print_r($errors);
}

Options

Fully documentation of class options and features.

  • limit Maximum Limit of files. {null, Number}
  • maxSize Maximum Size of files {null, Number(in MB's)}
  • extensions Whitelist for file extension. {null, Array(ex: array('jpg', 'png'))}
  • required Minimum one file is required for upload {Boolean}
  • uploadDir Upload directory {String}
  • title New file name
    • null Uploads with original file name
    • String Custom file name | use: auto, name, {{random}}, {{file_name}}, {{file_size}}, {{timestamp}}, {{date}}, {{extension}}, {{.extension}}
    • Array
      • String Custom file name | use: auto, name, {{random}}, {{file_name}}, {{file_size}}, {{timestamp}}, {{date}}, {{extension}}, {{.extension}}
      • Number Random name length
  • removeFiles Enable file exclusion
    • Boolean extra for plugin jQuery.filer
    • String $_POST field name containing json data with removed files names
  • replace Replace the file if it already exists {Boolean}
  • perms Uploaded file permisions {null, Number}
  • onCheck A callback function name to be called by checking a file for errors (must return an array) | ($file)
  • onError A callback function name to be called if an error occured (must return an array) | ($errors, $file)
  • onSuccess A callback function name to be called if all files were successfully uploaded | ($files, $metas)
  • onUpload A callback function name to be called if all files were successfully uploaded (must return an array) | ($file)
  • onComplete A callback function name to be called when upload is complete | ($file)
  • onRemove A callback function name to be called by removing files (must return an array) | ($removed_files)

Support

Questions or need help? You can ask it by writing us an Email or using StackOverflow site where you are most likely to get answer quickly. Make sure you add the tags "php", "php-upload" and "jquery.filer" when posting.

If you run into an issue and need to report a bug or you just have a question, please create an Issue on GitHub issues and we will investigate it.

jQuery.filer

jQuery.filer - Simple HTML5 File Uploader, a plugin tool for jQuery which change completely File Input and make it with multiple file selection, drag&drop support, different validations, thumbnails, icons, instant upload, print-screen upload and many other features and options.
jQuery.filer

License

Licensed under MIT license.

php-uploader's People

Contributors

creativedream avatar tropotek avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.