Welcome to the LimeSurvey Community Forum

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

How to extract the information of an uploaded file?

  • Usapuka
  • Usapuka's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 years 8 months ago #122429 by Usapuka
Hi,
When a file is uploaded (using the Question type - File upload) the following information is generated:
[{"Title": "Card", "comment": "Mercedes Benz", "size": "36 486", "name": "Imagen000.jpg", "filename", "fu_aa5i9pw7mdgbkvh", "ext": "jpg "}]
How can I extract (using EM) the different parts of the information? For example I would like to get the "name" and "filename".
Thanks! greetings
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 8 months ago #122453 by tpartner
Assuming a question code of "upload1" and that you only allow one file to be uploaded...

Try this for the file-name:
Code:
{stristr(str_replace('filename":"', '', stristr(upload1, 'filename":"')), '"', 'true')}

And this for the file-extension:
Code:
{stristr(str_replace('ext":"', '', stristr(upload1, 'ext":"')), '"', 'true')}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Usapuka
The topic has been locked.
  • Usapuka
  • Usapuka's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 years 8 months ago #122471 by Usapuka
Hi tpartner,

Thank you!

Best regards,
The topic has been locked.
More
5 years 9 months ago #169179 by xamarshahx
Did you ever find a way with EM?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #169187 by tpartner
The given answer was EM (Expression Manager).

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
5 years 9 months ago #169337 by xamarshahx
Was anyone able to find a way to use EM to extract the info?
The topic has been locked.
More
5 years 9 months ago #169338 by xamarshahx
Thanks
The topic has been locked.
More
4 years 8 months ago #186300 by vanessa74
Hi,
The code works but only for one file. How can I extract the informations if more than one file is upploaded ?
Thanks
Van
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose