Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

programatically upload files in answer

  • zufolo441
  • zufolo441's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 month 6 days ago #267734 by zufolo441
programatically upload files in answer was created by zufolo441
Hi all,
is there a way to upload files in file upload field answers
via JSON API?
I found upload_file method, that uploads files in /tmp/upload/ and calls them futmp_ etc, but I don't know how to proceed for moving it into upload/surveys/{sid}/files/ and associating it to an answer record.

Suggestions? thanks!
I'm using LS 6.6.6

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
1 month 5 days ago - 1 month 5 days ago #267741 by DenisChenu
Replied by DenisChenu on topic programatically upload files in answer
I think you need
1. upload files and get the filname
2. Update the json string with api.limesurvey.org/classes/remotecontrol...thod_update_response

EDIT : oh ! you're right : github.com/LimeSurvey/LimeSurvey/blob/59...rol_handle.php#L3460 just upload to temporary dir …

I don't have an answer here.
I move to development. Personnaly, if i need such solutun i create my own RC function … gitlab.com/SondagesPro/RemoteControl/extendRemoteControl

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 1 month 5 days ago by DenisChenu. Reason: EDIT
The following user(s) said Thank You: zufolo441

Please Log in to join the conversation.

  • zufolo441
  • zufolo441's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 month 5 days ago #267745 by zufolo441
Replied by zufolo441 on topic programatically upload files in answer
It's curious that upload_file requires surveyID and fieldName and then uploads file only in generic /tmp folder, whitout possibility to move file elsewhere.
It looks like unfinished stuff.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
1 month 5 days ago #267747 by DenisChenu
Replied by DenisChenu on topic programatically upload files in answer

It looks like unfinished stuff.
 
Same opinion here … and why ask survey Id and don't use it ?
If file was moved to /upload/survey/XXXX/files/ , you can use randfilename to update respo,nse, but here ? No way…
 

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose