View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
20058Bug reportsRemoteControlpublic2025-05-09 07:48
Reporteralainl88 Assigned Totibor.pacalat  
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
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 heat10
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, chimp358

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

guest

guest

2025-05-05 17:58

viewer   ~82567

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=38808

LimeBot

LimeBot

2025-05-06 11:54

administrator   ~82580

Fixed in Release 6.13.2+250506

Related Changesets

LimeSurvey: master f7d92c4d

2025-05-05 17:58

Alain Lima

Committer: GitHub


Details Diff
Fixed issue 20058: Can't retreive a file uploaded with RC api (04241) Affected Issues
20058
mod - application/helpers/remotecontrol/remotecontrol_handle.php Diff File

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
2025-05-05 17:58 Changeset attached => LimeSurvey master f7d92c4d
2025-05-05 17:58 guest Note Added: 82567
2025-05-05 17:58 guest Bug heat 4 => 6
2025-05-05 17:59 tibor.pacalat Assigned To => tibor.pacalat
2025-05-05 17:59 tibor.pacalat Status assigned => resolved
2025-05-05 17:59 tibor.pacalat Resolution open => fixed
2025-05-06 11:54 LimeBot Note Added: 82580
2025-05-06 11:54 LimeBot Status resolved => closed
2025-05-06 11:54 LimeBot Bug heat 6 => 8
2025-05-09 07:48 chimp358 Issue Monitored: chimp358
2025-05-09 07:48 chimp358 Bug heat 8 => 10