verot / class.upload.php

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.
http://www.verot.net/php_class_upload.htm
GNU General Public License v2.0
853 stars 359 forks source link

How to upload images taken from a cell phone? #139

Closed tiagocaus closed 4 years ago

tiagocaus commented 4 years ago

This low code works when I upload it through the browser, but I can't upload it when I access the same link via a cell phone.

How to upload images taken from a cell phone?

Thank you.

    if(!empty($_FILES['foto']['name'])) {
        $handle = new \Verot\Upload\Upload($_FILES['foto']);
        if ($handle->uploaded){
            $handle->file_new_name_body   = date('dmYhis');
            $handle->image_resize         = true;
            $handle->image_x              = 500;
            $handle->image_ratio_y        = true;
            $handle->jpeg_quality         = 85;
            $handle->image_convert        = 'png';
            $handle->file_overwrite       = true;
            $handle->file_auto_rename     = false;
            $handle->mime_check = true;
            $handle->Process('./uploads/veiculos/');
            $foto = $handle->file_dst_name;

            if ($handle->processed) {
                $handle->clean();
            }else{
                echo '  Erro: ' . $handle->error . '';
            }
        }
    }
verot commented 4 years ago

Please note that it is not a support forum. Check the logs produced by the class in order to find out more about your issue.

nilsonpessim commented 1 year ago

Olá tiagocaus, eu estava com um problema semelhante, para envio de imagens via celular, a imagem não subia de nenhuma forma, eu tenho uma validação de extensão, e a imagem não carregava, sendo assim eu não conseguia validar qual era a extensão do arquivo.

Pelo log, eu consegui verificar que o tamanho máximo do upload para o servidor era o padrão, 2M. foi só ajustar o upload max file size do apache, e tudo funcionou perfeito.