Skip to content

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

License

Notifications You must be signed in to change notification settings

snr278/php-uploader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

[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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%