How to extract the information of an uploaded file?

More
4 years 1 month 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

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
4 years 1 month 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:
{stristr(str_replace('filename":"', '', stristr(upload1, 'filename":"')), '"', 'true')}

And this for the file-extension:
{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.
Official LimeSurvey Partner - partnersurveys.com
The following user(s) said Thank You: Usapuka

Please Log in or Create an account to join the conversation.

More
4 years 1 month ago #122471 by Usapuka
Hi tpartner,

Thank you!

Best regards,

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #169179 by xamarshahx
Did you ever find a way with EM?

Please Log in or Create an account to join the conversation.

More
1 year 2 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.
Official LimeSurvey Partner - partnersurveys.com

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #169337 by xamarshahx
Was anyone able to find a way to use EM to extract the info?

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #169338 by xamarshahx

Please Log in or Create an account to join the conversation.

More
1 month 1 week 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

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!