Giter VIP home page Giter VIP logo

verot / class.upload.php Goto Github PK

View Code? Open in Web Editor NEW
840.0 840.0 361.0 641 KB

This PHP class uploads files and manipulates images very easily. It is in fact as much as an image processing class than it is an upload class. Compatible with PHP 4, 5, 7 and 8. Supports processing of local files, uploaded files, files sent through XMLHttpRequest.

Home Page: http://www.verot.net/php_class_upload.htm

License: GNU General Public License v2.0

PHP 98.37% HTML 1.63%

class.upload.php's People

Contributors

codelingobot avatar cyberwani avatar emretulek avatar eom avatar fevangelou avatar halillusion avatar lukacat10 avatar mad182 avatar peterdd avatar seb33300 avatar verot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

class.upload.php's Issues

IOS direct upload orientation?

Still having trouble with pictures shot on IOS10 with iPhone6 in portrait mode. After upload without first editing photo shows up as landscape. Should this be working properly in latest release?

Chnage The Name of File Uploaded On Class.upload.php

Hiii ,
First , I would Thank you For the Great Class 👍 , Second , I want To know Ho to change The name Of the File , I won't To fix the first name . and I want to change _1 I won't it ... Please Excuse me And Thank u Again

It automatically rotates some images

This is my code -

foreach ($images as $image)
{
    $handle = new upload($image);
    if ($handle->uploaded)
    {
        $handle->file_new_name_body   = 'image_resized';
        $handle->image_resize         = true;
        $handle->image_x              = 1170;
        $handle->image_ratio_y        = true;
        $handle->process('/images/web_launch/processed/');
        if($handle->processed)
        {
            echo 'image resized<br>';
            // $handle->clean();
        }
        else
        {
            echo 'error : ' . $handle->error."<br>";
        }
    }
}

The conversion and compression is working fine but it automatically rotates some images 90 degrees anti-clock wise .

Directory removal

I want to suggest to add a parameter, you may be interested
Before you perform
$Handle->clean();

2 parameters:

$Handle->directory_removal_status = TRUE;
$Handle->directory_removal = '/dir1/dir2/dir3/';

For example, we have a file is:
'Uploads/foto/dir1/dir2/dir3/file.jpg'

Delete the file:
$Handle->clean ();

check:
directory removal and file path to compliance

'/dir1/dir2/dir3/' == 'uploads/foto**/dir1/dir2/dir3/**file.jpg'
And remove directory:
uploads/foto/dir1/dir2/dir3
uploads/foto/dir1/dir2
uploads/foto/dir1

If the bottom is no other directories and files

csv saves a txt

HI i need to upload csv files but when i do i only get a txt file i know it will still work but when i try to delete the file it never does as it doesn't exist as csv but txt.

Save thumb and big

tell me how to best save the downloaded image in two versions: small and big. Now I just call twice to obtain the image, but the process takes a relatively long time.

function GetImage($s){  
        $handle = new upload($_FILES['image'], 'ru_RU');
        if ($handle->uploaded) {            
            $handle->image_x              = $s;
            $handle->image_y              = $s;

            if ($handle->processed) {
                //echo 'image resized';
                return $handle->process();
                $handle->clean();
            } else {
                echo'image error : ' . $handle->error;
            }
        }
    }

Call:

$Item["imagethumb"] = GetImage(100);
$Item["imagebig"] = GetImage(1024);

array_key_exists() expects parameter 2 to be array

Hi,
I'm implementing a class in a news toy system.
My system is structured as seguite way: A Model class, extends the class.upload.php and a Controller class I implement the Model.
It is my model:

UploadFile class extends upload {
   
     public function __construct () {
         $this->file_new_name_body = md5 (uniqid () . date ('dmaHis'));
         $this->file_auto_rename;
     }
    
}

And my Controller:

$uploadImage = new UploadFile ($_FILES['img_destaque']);
         $uploadImage-> process (DIR . 'images /');
         $imageName = '';

         if ($uploadImage->processed) {
             $imageName = $uploadImage->file_dst_name;
         } Else {
             $otherData ['errorImage'] = $uploadImage-> error;
         }

The error that returns me is:
array_key_exists () expects parameter 2 to be array, null given in /var/www/html/simplecms/vendor/verot/class.upload.php/src/class.upload.php on line 2598

What is wrong?

How to upload images with details of images.

I try to upload images to server.

When i download images from server it's not have details of images like a iso speed, exif,date created, date modify, camera marker,camera model like that.

Thank you.

Cannot End Filename In Variable

This issue occurs when you try to save a filename ending in a variable.

The following does not work:

$handle->file_new_name_body = "img_{$var}";

But this does work:

$handle->file_new_name_body = "img_{$var}_"; // <-- note the underscore

In the first instance, the class tries to rename the filename by appending an integer suffix; _1, _2 and so on, between the supplied filename and the file extension. In the above example, if the value of $var = 'test'; the resulting filename will be img_test_1.jpg

If I set the option:

$handle->file_auto_rename = false;

then the file is not saved at all.

why $handle->image_convert = 'png' not work

why $handle->image_convert = 'png' not work
img upload success,but jpg not convert png
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mhash
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

PHP 7 compatibility

Line 2504: PHP 4 constructors are now deprecated
function upload($file, $lang = 'en_GB')
{
}

composer not working proberly

Hi;
Nice class no doubt! But would be nice if you got it working with the autoloader featured by composer, right now i got to load this manual.

File size Explained

First let me say great code, helped me a lot and saved lots of time.
I'm trying to implement this but having some issues resizing the images. I'm setting the limit for the file size to 4MB, however when uploaded i wanted to resize the Pic to around 500 to 600kb so that it is faster on loading an image gallery and keeps great viewing dimensions(large format so when you hover on the image it will enlarge to show the full image). this is my setup, i have been playing with this and can't get it right, the image keeps resizing to like a thumbnail size.
What am i doing wrong here?

thanks for the help`

$handle->file_new_name_body = $fileNameNew;
$handle->file_safe_name = true;
$handle->file_overwrite = true;
$handle->dir_auto_create = true;
$handle->file_max_size = '4194304'; // 4MB
$handle->allowed = array('image/*');
$handle->image_convert = $defaultExt;
//$handle->image_resize = true;
$handle->image_ratio = true;
//$handle->image_ratio_x = true;
//$handle->image_x = 1500;
//$handle->image_ratio_no_zoom_in = true;
$handle->image_ratio_pixels = 25000;

Url image server

Add the ability to process images already uploaded to the server.
Example:
$handle = new upload( 'url image server', 'fr_FR', FALSE);
FALSE indicates that it is not $ _FILE and the image is already located on the server

Cropping not working

I have a PHP page that uses php_class_upload. All works well except that I'm having issues with cropping.

I pass the Left, Top, Right, and Bottom values all values come across (no issues here)

Log:

[27-Aug-2015 19:31:40 America/Chicago] top 52 ,right 239 , bottom 172 ,left 119

What I'm trying to accomplish is resize the image then crop it.

I have set up the following code for php_class_upload:

 $foo->file_new_name_body =  $new_image_name;
 $foo->image_resize = true;
 $foo->image_x = $_width;
 $foo->image_ratio_y = true;
 $foo->image_convert = png;
 $foo->Process( $structure);
 $foo->image_rotate = $rotate;      
 $foo->image_crop = array($top ,$right,$bottom,$left); //  'T R B L'.

The image uploads okay and its resizes correctly. however the cropping is not applied.
(just a note, I want the crop after the resize)

I also tried to hard code the vales like below
$foo->image_crop = '5 40 10% -20';
$foo->image_crop = array( 0,100,100,0);
$foo->image_crop = '0,100,100,0';

I think my issue is how I'm setting up the array but I'm at a point where I need help. Any help at all would be greatly appreciated.

Can't upload without setting "action" on form

when using $_SERVER['REQUEST_METHOD'] == 'POST' to handle my POST requests I simply can't instantiate a new object but I can grab my $_FILES normally (I thought thats basically what it needs to make a new object) why is that?

When posting zip file script doesn't work

When i try to upload zip file or any file that is above 1.5 mb then the code below this line doesn't execute

require ('../library/verot/class.upload.php');

   $handle = new upload($_FILES['shareFile']);
   if ($handle->uploaded)
   { echo "script working"; exit;

but above example doesn't echo anything what could be the reason because no error is generated in the php

image upload using FTP connection

image upload using FTP connection it's possible?
my hosting server has 2mb upload limit, I could create a script to send the picture, use the class_upload to resize, use the resized image and erase the big picture?
What is the shipping method that uses class_upload?

Sorry for bad English

thumbnails not processed when files are larger (> 2mb)

Love the class, but although the original image is processed successfully, the resized thumbnail is not, if the original image is over 2mb. Smaller images of 500kb or so, process the thumbnail successfully.

<?php

if ((isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '')) == 'xhr') {

    // ---------- XMLHttpRequest UPLOAD ----------
    // we first check if it is a XMLHttpRequest call
    if (isset($_SERVER['HTTP_X_FILE_NAME']) && isset($_SERVER['CONTENT_LENGTH'])) {

        // we create an instance of the class, feeding in the name of the file
        // sent via a XMLHttpRequest request, prefixed with 'php:'
        $handle = new Upload('php:'.$_SERVER['HTTP_X_FILE_NAME']);

    } else {
        // we create an instance of the class, giving as argument the PHP object
        // corresponding to the file field from the form
        // This is the fallback, using the standard way
        $handle = new Upload($_FILES['my_field']);
    }

    // then we check if the file has been uploaded properly
    // in its *temporary* location in the server (often, it is /tmp)
    if ($handle->uploaded) {
        //$timestamp = date("ymd-His")."_";//uncomment to add timestamp to file name

        //$handle->file_name_body_pre = $timestamp;
        $handle->Process($dir_dest);
        // yes, the file is on the server
        // now, we start the upload 'process'. That is, to copy the uploaded file
        // from its temporary location to the wanted location
        // It could be something like $handle->Process('/home/www/my_uploads/');

        // we check if everything went OK
        if ($handle->processed) {
            // everything was fine !
            echo '<p class="result">';
            echo '  <b>Photo uploaded successfully.</b><br />';
            echo '  File: <a href="'.$dir_pics.'/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a>';
            echo ' ('.human_filesize(filesize($handle->file_dst_pathname)).')';
            echo '</p>';
            echo('<img src="'.$handle->file_dst_pathname.'" class="img-responsive">');

        } else {
            // one error occured
            echo '<p class="result">';
            echo '  <b>File not uploaded to the wanted location</b><br />';
            echo '  Error: ' . $handle->error;
            echo '</p>';
        }

        //added this... do some resizing:
        $handle->image_resize         = true;
        $handle->image_x              = 300;
        $handle->image_ratio_y        = true;
        $handle->file_name_body_add = '_thumb';

        $handle->Process($dir_dest);
        //and then create the thumb
        if ($handle->processed) {
            // everything was fine !
            echo '<p class="result">';
            echo '  <b>Thumbnail created successfully.</b><br />';
            //echo '  File: <a href="'.$dir_pics.'/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a>';
            //echo ' ('.human_filesize(filesize($handle->file_dst_pathname)).')';
            echo '</p>';
        } else {
            // one error occured
            echo '<p class="result">';
            echo '  <b>Unable to create thumbnail.</b> Please contact [email protected]<br />';
            echo '  Error: ' . $handle->error . '';
            echo '</p>';
        }
        // we delete the temporary files
        $handle-> Clean();

    } else {
        // if we're here, the upload file failed for some reasons
        // i.e. the server didn't receive the file
        echo '<p class="result">';
        echo '  <b>File not uploaded on the server</b><br />';
        echo '  Error: ' . $handle->error . '';
        echo '</p>';
    }
}

if (isset($handle)) {
    //echo '<pre>';
    //echo($handle->log);
    //echo '</pre>';
}

function human_filesize($bytes, $decimals = 1) {
    $size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
    $factor = floor((strlen($bytes) - 1) / 3);
    return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor];
}
?>

Form is here:
http://photobr.org/resizer/upload_form.php

Listing of files uploaded is here:
http://photobr.org/resizer/uploads/

No errors are thrown.
Only one old error in the logs:
[31-Aug-2015 02:32:48 UTC] PHP Notice: Undefined variable: timestamp in /home/retinacanadaftp/public_html/photobr.org/resizer/oad.phuplp on line 57

File Type Validation with File Extension

@verot
Add support for file type validation with file extension.

Currently, I am doing like this.

$file_types = array(
    'doc',
    'docx',
    'txt',
    'xls',
    'xlsx',
    'csv',
    'jpg',
    'jpeg',
    'png'
);
$handle = new Upload($file);
if ($handle->uploaded) {
    $file_types_mime = array();
    foreach( $file_types as $file_type ){
        $file_types_mime[] = $handle->mime_types[$file_type];
    }
    $handle->allowed = $file_types_mime;
}

PCRE issue?

recently upgraded MAMP (v 3.3) using php v 5.4.42

PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in .../class.upload_0.32.php on line 2899
PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in .../class.upload_0.32.php on line 2939
PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in .../class.upload_0.32.php on line 2966
PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in .../class.upload_0.32.php on line 2993
PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in .../class.upload_0.32.php on line 3011

escaping the hyphens should fix this.

example from line #2899

  • if (preg_match("/^([.-\w]+)/([.-\w]+)(.*)$/i", $this->file_src_mime)) {
  • if (preg_match("/^([.-\w]+)/([.-\w]+)(.*)$/i", $this->file_src_mime)) {

Animated gifs stopped working in latest version

Hello!

There seems to be a problem with animated gifs on latest version 0.34dev.
When I'm uploading animated gifs, it converts them to static images keeping only the first frame after processing, even when mage_resize is set to false and no other manipulations are set.

Animated gifs are working fine on version 0.33dev and older.

My settings:

$upload = new Upload($_FILES['new-image']);
$upload->file_overwrite = true;
$upload->file_auto_rename = false;
$upload->mime_check = true;
$upload->no_script = true;
$upload->file_max_size = '20M';
$upload->allowed = ['image/*'];
$upload->image_resize = false;

PHP version: 7.0.11

It happens with any animated gif image I tried, e.g. https://gif-avatars.com/img/150x150/happy-cat.gif

Upload multiple images

I noticed that the object need to be initialized using "new Upload($_FILES["file"]);". However, if I upload multiple files in a single request, how can I process every one of them? If I use following code, only the first image got processed.

$foo = new Upload($_FILES["file"]);
if ($foo->uploaded) {
  $foo->file_new_name_body = "test";
  $foo->image_resize = true;
  $foo->image_convert = png;
  $foo->image_y = 300;
  $foo->image_ratio_y = true;
  $foo->Process('img/');
  if ($foo->processed) {
    echo 'original image copied';
  } else {
    echo 'error : ' . $foo->error;
  }
} else echo 'error : ' . $foo->error;

Error file_max_size and mime_check

Hi, I am testing the class 0.33dev with this settings:

if ($handle->uploaded) {
    $handle->file_max_size = '1000000'; // 1MB
    $handle->mime_check = true;
    $handle->allowed = array('image/*');
        ....

but I can upload others files types (.pdf, .xlsx) and sizes more than 1MB

Thanks a lot

system information
- class version           : 0.33dev
- operating system        : Linux
- PHP version             : 5.3.29
- GD version              : 2.1.0
- supported image types   : png jpg gif bmp
- open_basedir            : no restriction
- upload_max_filesize     : 2M (2097152 bytes)
- language                : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
    Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
    MIME type detected as application/pdf; charset=binary by UNIX file() command
- MIME validated as application/pdf
source variables
- You can use all these before calling process()
    file_src_name         : 215_MyF-InformeMensual-Feb15.pdf
    file_src_name_body    : 215_MyF-InformeMensual-Feb15
    file_src_name_ext     : pdf
    file_src_pathname     : /tmp/phpCe3a64
    file_src_mime         : application/pdf
    file_src_size         : 1899696 (max= 2097152)
    file_src_error        : 0
process file to tmp/
- error: File too big. : 1899696 > 1000000
process file to tmp/
- file size OK
- file mime OK : application/pdf
- file name safe format
- destination variables
    file_dst_path         : tmp/
    file_dst_name_body    : 215_MyF-InformeMensual-Feb15
    file_dst_name_ext     : pdf
- checking for auto_rename
- destination file details
    file_dst_name         : 215_MyF-InformeMensual-Feb15.pdf
    file_dst_pathname     : tmp/215_MyF-InformeMensual-Feb15.pdf
- 215_MyF-InformeMensual-Feb15.pdf doesn't exist already
- no image processing wanted
- process OK
cleanup
- delete temp file /tmp/phpCe3a64

preg_replace will be deprecated in php from php 5.5

Hi there,

My webhost is not supporting older versions than 5.6 because of safety issues. The preg_replace function will be deprecated from php 5.5 and on so I can't use this upload class anymore!

It is possible for you to rewrite the upload class to make it compatible with php versions > 5.5? So all the calls for preg_replace need to be reworked to preg_replace_callback.

Looking forward to your reaction.

Regards,

Crispijn, Amsterdam

Line number 2324: you missed a slash

Line number 2324: you missed a slash ('/') in-front of 'extras/magic'
Not sure about other environment but with XAMPP it tries to look for the magic_file in (C:\xampp\phpextras\magic)
So, it prints:
E_WARNING - finfo_open(C:\xampp\phpextras\magic): failed to open stream: No such file or directory in file C:\xampp\htdocs\www\lib\class.upload.php on line 2337

Allowed memory size exhausted

Soo my problem is this - i was using version .33dev and all worked fine except i run into image orientation problem, soo i looked for posible solutions and found that version .33 has built in image_auto_rotate soo i was really happy, but when im using the new version im runing into the problem, that wasnt before - if i upload big images ~4Mb i have fattal error: Allowed memory size exhausted, i have post limit 64Mb, file upload limit 30Mb and memory limit 128Mb, soo im baffled what is wrong. Can you please help me?

how to crop image and resize

--------- To RU
Привет! отличный скрипт!
Подскажи пожалуйста, как решить мою проблему
я использую скрипт http://odyniec.net/projects/imgareaselect/
как использовать параметры которые выдает этот плагин, чтобы сделать кроп картинки с помощью твоего плагина?
какому параметру в Upload() передавать координаты (X1: Width: Y1: Height: X2: Y2:) новой картинки?
Заранее спасибо за помощь!
--------- To EN
Hello! a great script !
Please tell me how to solve my problem
I use a script http://odyniec.net/projects/imgareaselect/
how to use the options that gives this plugin to make crop pictures using your plugin ?
what parameter in the Upload() to transmit the coordinates (X1: Width: Y1: Height: X2: Y2 :) a new picture ?
Thank you in advance for your cooperation!

FILE_MAX_SIZE Bug

Hello
I will upload the problem I think is a bug
When I upload a large file size , error is displayed correctly but if I view the source code on the same page with me, and I will refresh the view source page , file be uploaded

by google translate

My Yii 1.1 Upload Action code:

public function actionUpload($upload = "image") {
        $destPath = Yii::getPathOfAlias('webroot.uploads');
        $thubms = Yii::getPathOfAlias('webroot.uploads.thumbs');
        $errors = array();
        if (isset($_FILES['img'])) {
            Yii::import('ext.upload.Upload');
            $Upload = new Upload((isset($_FILES['img']) ? $_FILES['img'] : null), 'fa_IR');
            $Upload->no_script = false;
            $Upload->allowed = array('image/*');
            $Upload->mime_check = true;
            $Upload->image_resize = true;
            $Upload->file_max_size = '3145728'; # 3MB
            $Upload->image_x = 800;
            $Upload->image_y = 800;
            $Upload->image_interlace = true;
            $Upload->image_ratio = true;

            $newName = md5(microtime() . $Upload->file_src_name);
            $destName = '';
// verify if was uploaded
            if ($Upload->uploaded) {
                $Upload->file_new_name_body = $newName;
                $Upload->process($destPath);

                // if was processed
                if ($Upload->processed) {
                    $destName = $Upload->file_dst_name;
                    $destPathname = $Upload->file_dst_pathname;
                    /* creating thumbnail uploaded image */
                    $Upload->image_resize = true;
                    $Upload->image_x = 600;
                    $Upload->image_y = 600;
                    $Upload->image_ratio = true;
                    $Upload->file_new_name_body = $newName;
                    $Upload->process($thubms);

                    if ($Upload->processed) {
                        $destName = $Upload->file_dst_name;
                        echo Yii::app()->createAbsoluteUrl('uploads/thumbs/' . $destName);
                    } else {
                        print "error";
                    }
                } else {
                    echo "<pre dir='ltr'>error: " . $Upload->error . "</pre>";
                }
            } else {
                echo 'error';
            }
        }
        $this->render('_UploadForm');
    }

Returns original file extension

Hi verot

$img_upload = new upload($_FILES['doska_img']);
$img_file_name = "doska_img".date("Ymdhis");
if ($img_upload->uploaded) {
  $img_upload->file_new_name_body   = $img_file_name;
  $img_upload->image_resize         = true;
  $img_upload->image_x              = 435;
  $img_upload->image_y              = 280;
  $img_upload->image_convert        = 'png';
  $img_upload->process($az_cms_file_upload_folder);
  if ($img_upload->processed) {
    $img_upload->clean();
  } else {
    echo 'error : ' . $img_upload->error;
  }
}
echo $img_upload->file_dst_ext == 'jpg'; //true

Warning: preg_match(): Compilation failed: invalid range in character class at offset 7

Hi verot,

first I would say thank you for your beautiful upload class and your work.

Nowdays, when I use your class I become 5 warnings with the same issue, because of my new PHP Version 5.6.

Warning: preg_match(): Compilation failed: invalid range in character class at offset 7
if (preg_match("/^([.-\w]+)/([.-\w]+)(.*)$/i", $this->file_src_mime)) {

I'm not a "regex-expert", I found on stackoverflow that the dash must be escaped because of the PHP Version 5.6. " -". Is this correct?

Thanks for your answer and greetings from Berlin,

Max

MIME types for office documents now working

I've been trying to upload some excel files and I've set up mime types like this:
$handle->allowed = array('application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', 'application/vnd.ms-excel.addin.macroEnabled.12');

Using all the excel mime types I've found, but I still get "Incorrect type of file" on every .xlsx file while .xls uploads without a problem.

(Same problem with .docx, .pptx)

When I try to get file mime type with ->file_src_mime i get either "application/zip" or "application/x-empty"

processed flag

comments written "Flag set after calling a process". but why the flag is active even before the call to the process itself?
if ($handle->processed) $ResultImage = $handle->process();

When resize = true, the upload is too slow

I've implemented the script, but when the resize option is true, the upload seems to be too slow to finish, even in localhost. I'm using wamp server with gd2 activated. There's any solution for this?

Require dev-master

Firstly we want to congrats you for this awesome feature.
I personally have used this class for a long years ago. Thank you.

Hello, we use this class in our project SuitUp PHP Framework.
We got an error while try to install dependencies with composer when it is in dev-master. The point is that you recommend us to use as dev-master.

So, do have too much difference between dev-master and 0.33 release?

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.