Upload file in form does not exist or is not readable

Created on 23 April 2024, 8 months ago
Updated 27 May 2024, 7 months ago

Problem/Motivation

Hello,

I set up a Drupal form which allows you to upload a file and then process it in the code.

But i got the error : TxTextControl\ReportingCloud\Exception\InvalidArgumentException: "/app/devs/tmp/EU27_uk_2.doc" does not exist or is not readable in TxTextControl\ReportingCloud\Assert

I have the same form and the same code on a site where the cdn is not activated and I have no error, whereas when the cdn is activated I have the error

In addition, when I get the error I just have to wait 4-5 seconds on the error page then refresh the page and it works afterward it finds the file

My code :

        // Get file
        $fileUpload = $form_state->getValue('file_upload');
        $fid        = $fileUpload[0];
        $file       = File::load($fid);
        if ($file == null) {
            \Drupal::messenger()->addError('Error while loading file');
            return;
        }
        $fileUri = \Drupal::service('file_system')->realpath($file->getFileUri());

        $binaryData = $reportingCloud->convertDocument($fileUri,
            'HTML');


Thanks for your help

Version

Drupal 10.2.3
CDN 4.0.2
I use aws cloudfront for cdn

💬 Support request
Status

Closed: cannot reproduce

Version

4.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hiiidro
  • Status changed to Postponed: needs info 8 months ago
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
    1. That looks like an exception thrown by a contrib/custom module. What module is that?
    2. How did you configure Cloudfront?
  • Status changed to Closed: cannot reproduce 7 months ago
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Closing due to lack of response.

Production build 0.71.5 2024