PHP code example of pa-bru / file-uploader

1. Go to this page and download the library: Download pa-bru/file-uploader library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pa-bru / file-uploader example snippets



$file = $_FILES["myfile"];

$args = [
	  "fileName" => "my-filename",
          "contentDir" => "my-directory/",
          "allowedExts" => array(),
          "maxSize" => 1000000,
          "width" => 200,
          "height" => 300
];

$uploader = new FileUploader($file, $args);


$uploader->getFileExtension();

$uploader->getPath();

$uploader->getHeight();

$uploader->getWidth();

$uploader->getMaxSize();

$uploader->getContentDir();

$uploader->getFileName();

$uploader->getTmpFile();

$uploader->getAllowedExts();

$uploader->setPath($path);

$uploader->setHeight($height);

$uploader->setWidth($width);

$uploader->setMaxSize($maxSize);

$uploader->setContentDir($contentDir);

$uploader->setFileName($fileName);

$uploader->setTmpFile($tmpFile);

$uploader->setAllowedExts(array $allowedExts);

$uploader->upload();