Skip to content

Php single file uploader class without any dependicies.

License

Notifications You must be signed in to change notification settings

BackendDevops/OdinUploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

OdinUploader

Php single file uploader class without any dependicies.

Usage

Create an HTML form like this.

<form method="POST" enctype="multipart/form-data">
  <input type="hidden" name="MAX_FILE_SIZE" value="1000000"/>
  <input type="file" name="file" />
  <input type="submit" value="upload"/>
</form>

And copy & paste the following code to upload the image

require_once  "path/to/Uploader.php";



    $uploader=new Uploader($_FILES['file']);
    $uploader->setLocation(__DIR__.'/'.'uploads/');
    $result= $uploader->upload();
    

You can Allow Some other extentions inside class mimeTypes variable

Allowed Mimetypes

 $this->mimeTypes=array('image/png','image/jpeg','image/jpeg','image/gif','application/xml','application/pdf','application/vnd.ms-excel');

Roadmap

Image-Resize
Image-Watermark
Image-Thumbs
...

Rest of these I am open to new ideas At the end you can freely use this class