Welcome Guest, Not a member yet? Register   Sign In
max_size fails
#1

PHP Code:
I have this input:

    <input id="delega" type="file" class="form-control" accept="application/pdf">

I send the pdf using an AJAX request:

var 
data JSON.stringify($('input[name="post_data"]').val());

    var url = `<?= base_url('appointments/ajax_register_appointment') ?>`;
    var $layer = $('<div/>');

    let formData = new FormData();
    formData.append('post_data'data);

    if (GlobalVariables.manageMode) {
        formData.append('exclude_appointment_id'GlobalVariables.appointmentData.id);
    }

    let delega document.getElementById('delega').files[0];
    if (delega !== undefined) {
        formData.append('delega'delega);
    }

    $.ajax({
            urlurl,
            method'post',
            dataformData,
            dataType'json',
            contentTypefalse,
            processDatafalse,

But if I upload a file of 172kb I get the error that is too large:

        $delega $this->request->getFile('delega');

        // controlla correttezza file
        if (!empty($delega)) {

            
            $validationRules 
= [
                'delega'        => 'mime_in[delega,application/pdf]|max_size[1024]'
            ];

            if (!$this->validate($validationRules)) {
                return $this->fail($this->validator->getErrors());
            }
        }

how is that possible
Reply


Messages In This Thread
max_size fails - by sfarzoso - 09-17-2021, 10:01 AM
RE: max_size fails - by iRedds - 09-17-2021, 02:49 PM
RE: max_size fails - by InsiteFX - 09-18-2021, 01:15 AM
RE: max_size fails - by sfarzoso - 09-18-2021, 03:21 AM
RE: max_size fails - by InsiteFX - 09-18-2021, 04:29 AM
RE: max_size fails - by sfarzoso - 09-18-2021, 08:04 AM
RE: max_size fails - by InsiteFX - 09-19-2021, 12:49 AM
RE: max_size fails - by sfarzoso - 09-19-2021, 05:36 AM
RE: max_size fails - by InsiteFX - 09-20-2021, 12:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB