You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2021-12-22 20:54:03

thiffaultg
Member
Registered: 2021-12-22
Posts: 2

API REST - Upload | ERROR_UPLOAD_FILE_TOO_BIG_POST_MAX_SIZE"

Hi,
We tried to upload files with the api rest, but we've always got this error message: "["ERROR_UPLOAD_FILE_TOO_BIG_POST_MAX_SIZE","The file seems too big"]".

We are able to create ticket, but can't add files to it.


Here the code, if you can help us :

        $ch = curl_init();

        $fileName = json_encode($_FILES["filename"]["name"]);
        curl_setopt($ch, CURLOPT_URL, $api_url . '/Document/');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);

        $post = array(
            'uploadManifest' => '{"input": {"name": "Upload","_filename": ["' . $fileName . '"]}};type=application/json',
            'filename[0]' => '@' .realpath(basename($_FILES["filename"]["name"]))
        );

        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

        $headers = array();
        $headers[] = 'Content-Type: multipart/form-data';
        $headers[] = 'Session-Token: '.$sess_token;
        $headers[] = 'App-Token: '.$app_token;
       
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

        $result = curl_exec($ch);

        curl_close($ch);


If you had any ideas, please share it



Thanks in advance smile

Offline

#2 2021-12-22 23:18:15

grenona
Member
From: Canada
Registered: 2021-08-11
Posts: 47

Re: API REST - Upload | ERROR_UPLOAD_FILE_TOO_BIG_POST_MAX_SIZE"

I'm sure you check this already.

just in case

ht t p s://www.tecmint.com/increase-file-upload-size-in-php/

Offline

#3 2021-12-22 23:31:30

thiffaultg
Member
Registered: 2021-12-22
Posts: 2

Re: API REST - Upload | ERROR_UPLOAD_FILE_TOO_BIG_POST_MAX_SIZE"

You do well to ask smile, but yes, we've put all these at 128MB,  to be sure

Offline

#4 2021-12-23 09:45:30

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 6,173

Re: API REST - Upload | ERROR_UPLOAD_FILE_TOO_BIG_POST_MAX_SIZE"

moved to API rest section.

see following links it can hel., error is probably not caused by oversized file.

https://forum.glpi-project.org/viewtopic.php?id=176544
https://forum.glpi-project.org/viewtopic.php?id=209103


Trouver la panne avant de réparer...
GLPI10.0.10 (ubuntu 22.04 PHP8.1  Mariadb10.6 ) plugins : comportements 2.7.2 reports 1.16.0 formcreator 2.13.8, datainjection 2.13.4 fields 1.21.6

Offline

Board footer

Powered by FluxBB