Skip to content

Extracted XoopsMediaUploader class from @XOOPS for handling file uploads.

License

Notifications You must be signed in to change notification settings

OldXoopsLibraries/media-uploader

Repository files navigation

License GitHub release Build Status

Media uploader

Extracted XoopsMediaUploader class from Xoops for handling file uploads.

Installation

composer require old-xoops-libraries/media-uploader

Example of usage

  $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png');
  $maxfilesize = 50000;
  $maxfilewidth = 120;
  $maxfileheight = 120;
  $uploader = new XoopsMediaUploader('/home/xoops/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
  if ($uploader->fetchMedia($_POST['uploade_file_name'])) {
             if (!$uploader->upload()) {
                echo $uploader->getErrors();
             } else {
                echo '<h4>File uploaded successfully!</h4>'
                echo 'Saved as: ' . $uploader->getSavedFileName() . '<br>';
                echo 'Full path: ' . $uploader->getSavedDestination();
             }
  } else {
             echo $uploader->getErrors();
  }

About

Extracted XoopsMediaUploader class from @XOOPS for handling file uploads.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages