View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
20058Bug reportsRemoteControlpublic2025-04-17 17:11
Reporteralainl88 Assigned To 
PrioritynoneSeveritypartial_block 
Status assignedResolutionopen 
Product Version6.6.x 
Summary20058: Can't retreive a file uploaded with RC api
Description

I'm trying to upload a file with RC api.
I upload the file with method upload_file() and passing the resulting metadata to a response.
Everything works fine but when I'm not able to download the file. If I try to download via RC api (method get_uploaded_files() ) I get the error "Could not find uploaded files". If I try to download from limesurvey admin dashboard, I get an empty file.
I have no access to the file manager so I cannot check if the file has been updated correctly but I can suppose that, since I get the metadata from upload_file(), everything works as expected.

Steps To Reproduce

PHP code to upload the file
$uploadedFile = $myJSONRPCClient->upload_file($sessionKey, $survey_id, $fieldName, $file["name"], base64_encode(file_get_contents($file["tmp_name"])));
if (isset($uploadedFile) && $uploadedFile["success"]) {
$uploadedFile = [$uploadedFile];

            $responseData = [
                "token"=> $token,
                "id"=> $idResponse,
                $fieldName => json_encode($uploadedFile),
                $fieldName."_filecount" => 1,
            ];

            $myJSONRPCClient->update_response($sessionKey, $survey_id, $responseData);

Expected result

The file is available

Actual result

I get an empty file

Tagsremote control
Attached Files
Bug heat4
Complete LimeSurvey version number (& build)LimeSurvey Community Edition Versione 6.12.4+250408
I will donate to the project if issue is resolvedYes
Browser
Database type & versionMariaDB
Server OS (if known)Ubuntu
Webserver software & version (if known)
PHP Version8.2

Users monitoring this issue

alainl88

Activities

alainl88

alainl88

2025-04-14 15:06

reporter   ~82423

I addressed the issue in file remotecontrol_handle.php.
upload_file() save to /tmp and get_uploaded_files() reads from Yii::app()->getConfig('uploaddir') . "/surveys/" . $iSurveyID . "/files/"
I think that since upload_file() asks for surveyID it must save in Yii::app()->getConfig('uploaddir') . "/surveys/" . $iSurveyID . "/files/"

alainl88

alainl88

2025-04-14 15:33

reporter   ~82424

I released a pull request https://github.com/LimeSurvey/LimeSurvey/pull/4241

Issue History

Date Modified Username Field Change
2025-04-11 17:48 alainl88 New Issue
2025-04-11 17:48 alainl88 File Added: survey_archive_323473.lsa
2025-04-13 18:04 alainl88 Issue Monitored: alainl88
2025-04-13 18:04 alainl88 Bug heat 0 => 2
2025-04-13 18:04 alainl88 Tag Attached: remote control
2025-04-14 15:06 alainl88 Note Added: 82423
2025-04-14 15:06 alainl88 Bug heat 2 => 4
2025-04-14 15:33 alainl88 Note Added: 82424
2025-04-17 17:11 c_schmitz Status new => assigned