• Resolved lightuono

    (@lightuono)


    Hi,

    When I try to upload a pdf file, I get the message
    
    An error occurred while loading. Try later.
    
    But if I refresh the page the file is still loaded. I tried to disable the ReMush plugin and I no longer have the error message.
    
    In the logs I have this,
    
    ==> resmushit.log <==
    [07-11-2022 11:01:21] Error! Incorrect attachment.1
    
    I use Imunify360 and this comes out
    
    [Mon Nov 07 12: 01: 19.065218 2022] [: error] [pid 6802: tid 139875927906048] [client xxxxx: 44578] [client 134.90.240.98] ModSecurity: Warning. Match of "rx ^ $" against "FILES_TMPNAMES: async-upload" required. [file "/etc/httpd/conf/modsecurity.d/rules/custom/000_i360_0.conf"] [line "155"] [id "77317957"] [msg "IM360 WAF: Track file upload || File: / var /imunify360/tmp_modsec/20221107-120119-Y2jlf7XUReyP2nbhYH9BaQAAABQ-file-WTpXEu||Size:3028||User:XXXX||SC:/var/www/vhosts/XXXX.edu.it/httpcupmins .php || T: APACHE || "] [severity" NOTICE "] [tag" service_i360custom "] [tag" noshow "] [hostname" www.XXXXX.edu.it "] [uri" / wp-admin / async -upload.php "] [unique_id" Y2jlf7XUReyP2nbhYH9BaQAAABQ "], referer: https://www.XXXXX.edu.it/wp-admin/upload.php
Viewing 5 replies - 1 through 5 (of 5 total)
  • kodell

    (@kodell)

    I just encountered the same issue today! I’ll put my statement here since it’s relevant. Until the devs fix it, I’ve manually applied a patch to my copy of the resmushit-image-optimizer/resmushit.php file. (change all the print_r( ... ) statements to print_r( ..., true ) )

    resmushit.php.diff:

    
    --- resmushit.php.orig	2022-11-07 16:01:47.378952239 -0600
    +++ resmushit.php	2022-11-07 15:56:34.991002341 -0600
    @@ -108,14 +108,14 @@
     
     	$fileInfo = pathinfo(get_attached_file( $attachment_id ));
     	if(!isset($fileInfo['dirname'])) {
    -		rlog("Error! Incorrect file provided." . print_r($fileInfo), 'WARNING');
    +		rlog("Error! Incorrect file provided." . print_r($fileInfo, true), 'WARNING');
     		return $attachments;
     	}
     	$basepath = $fileInfo['dirname'] . '/';
     	$extension = isset($fileInfo['extension']) ? $fileInfo['extension'] : NULL;
     	
     	if(!isset($attachments[ 'file' ])) {
    -		rlog("Error! Incorrect attachment." . print_r($attachments), 'WARNING');
    +		rlog("Error! Incorrect attachment." . print_r($attachments, true), 'WARNING');
     		return $attachments;
     	}
     	$basefile = basename($attachments[ 'file' ]);
    @@ -128,7 +128,7 @@
     	$statistics[] = reSmushit::optimize($basepath . $basefile, $force_keep_original );
     
     	if(!isset($attachments[ 'sizes' ])) {
    -		rlog("Error! Unable to find attachments sizes." . print_r($attachments), 'WARNING');
    +		rlog("Error! Unable to find attachments sizes." . print_r($attachments, true), 'WARNING');
     		return $attachments;
     	}
     	foreach($attachments['sizes'] as $image_style) {
    

    Hopefully this helps anyone else who stumbles on this.

    • This reply was modified 2 years ago by kodell. Reason: Markdown didn't format the way I expected. Removed 'diff' langcode
    T0ny

    (@t0ny)

    Thanks. Kodell’s change solved the issue. I was getting An error occurred while loading. Try later. with each upload before applying it.

    Plugin Contributor reSmush.it

    (@resmushit)

    Hi guys,

    Thanks for this reporting, we’ll have a look quickly.

    Regards,
    Charles

    Plugin Contributor reSmush.it

    (@resmushit)

    Hello, this issue has been fixed!
    Sorry for the convenience :/

    Regards,
    Charles

    Thread Starter lightuono

    (@lightuono)

    worked!! Thanks ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Error upload PDF’ is closed to new replies.