0

Problem Statement


So I do iTop Development ( A open source service desk software) .

While implementing a feature I got stuck on how to upload a file to the server directory but thanks to this stackoverflow question I was able to upload the file in my local machine with a project structure to test the feature. The minimal viable project went like this : -

./
├── index.html
├── index.js
├── upload.php
└── uploads
    ├── ocr.png
    └── ocr_prev_ui.png

and I used the same code that was specified in that question.

But when I put that same code in an already existing extension itop-attachments to add a field that would upload a temp file which gets deleted after an ocr operation is run, It throws the following error:

enter image description here

I even Searched the same question on sourceforge (Error: Unknown class ''.)

But it seems that it does not apply to my case.

Replication


  1. Try make a custom form that uploads file in the /var/www/html/itop/env-production/itop-attachments directory, using this code :
$oPage->add('<fieldset>');
        $oPage->add('<legend>OCR Attachment</legend>');
        $oPage->add('<div id="AttachmentsContent">');
        $oPage->add('<form id="ocr_form" action="'.utils::GetAbsoluteUrlAppRoot().'/env-production/itop-attachments/test.php" method="POST" enctype="multipart/form-data">');
        $oPage->add('<label for="OCR">Upload Image to Scan for OCR (png,jpg,jpeg):</label>');
        $oPage->add('<br>');
        $oPage->add('<br>');
        <-- This is where the Error is -->
        $oPage->add('<input type="file" id="OCR" name="OCR" accept="image/png, image/jpeg">');
        $oPage->add('<input type="submit" value="Upload OCR"/>');
                <-- Outputs -->
                <--Fatal error, iTop cannot continue. -->
                <--Error: Unknown class ''.-->
        $oPage->add('</form>');
        $oPage->add('</fieldset>');
  1. Now, Make an incident in iTop and attach a image in the newly created OCR Attachment formset
  2. Now click upload.

You will see the same Issue as I do .

Footnote

Environment :

Ubuntu 20.04 , 
Apache 2.4, 
PHP 7.4.3 , 
iTop 2.7

I am not able to solve this issue. Likely seems a PHP or iTop Speicific issue where it cannot find class="Incident" . I am not sure.

Lucifer
  • 79
  • 6

0 Answers0