Upload an image to a question

More
2 months 3 weeks ago #197315 by Fran1991
Hello everyone,

I am creating a product evaluation survey, I want the person who answers the survey to take a photo of the product they are evaluating and upload it to the survey, is there a way to do this?

It is worth mentioning that I need to validate this question so that the photograph is necessarily loaded in order to continue.

I appreciate your help too much. :)

Please Log in to join the conversation.

LimeSurvey Partners
More
2 months 3 weeks ago #197330 by tpartner

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 to join the conversation.

More
2 months 3 weeks ago #197374 by Fran1991
Thanks, I'll take a look

Please Log in to join the conversation.

More
2 months 3 weeks ago - 2 months 3 weeks ago #197381 by Fran1991
a
Attachments:
Last edit: 2 months 3 weeks ago by Fran1991.

Please Log in to join the conversation.

More
2 months 3 weeks ago - 2 months 3 weeks ago #197383 by Fran1991
Hi tpartner

I have read the manual, so I understand this type of question can only be applied to a single question.

Currently what I'm trying to do is to take a photo of a list of products and upload it to the survey. that is to say, that they select the product and attach their resoective photo,

I have managed to ask this type of question with the following HTML code:


<form action="../../form-result.php" method="post" enctype="multipart/form-data" target="_blank">

<p>

Sube un archivo:

<input type="file" name="archivosubido">

<input type="submit" value="Enviar datos">

</p>

</form>




The problem now is that I do not know if it is possible that these images are reflected in the survey database? or failing that they are hosted on the server. Is this possible?

If so, how can I know where the images are loaded?

Or if I am doing something wrong.

I appreciate too much time for my doubt.

Greetings.
Attachments:
Last edit: 2 months 3 weeks ago by Fran1991.

Please Log in to join the conversation.

More
2 months 3 weeks ago - 2 months 3 weeks ago #197385 by Joffm
Replied by Joffm on topic Upload an image to a question
Hi,
if you examine the answer table of the LS database "lime_survey_[surveyID]", you will see that an upload question has two fields in the datatable
in field {SGQ} of type "text" the file information, in field {SGQ}_filecount of type integer the count of uploaded files.
Like
"123321X123X9876": [{ "size":"102.65","name":"file.pdf","filename":"fu_trz5np4mn5pbgr4","ext":"pdf" }]
"123321X123X9876:filecount": 1

And you find the file "fu_trz5np4mn5pbgr4" itself in folder "/upload/surveys/[surveyID]/files" .

Now you may create these fields in the database by creating as many hidden upload questions as you may need.
And your "form-result.php" handles the upload and enters the data into the respective fields of the answer table.

If so, how can I know where the images are loaded?

Exactly this you have to do in your php file.

In my opinion this is really not the best.
Why can't you split the question?
1. The multipunch question to select the product(s).
2. For each product an upload question, displayed by relevance



And to validate?
Set the min count to "1".
https://manual.limesurvey.org/Question_type_-_File_upload#Minimum_number_of_files_.28minimum_number_of_files.29

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 2 months 3 weeks ago by Joffm.

Please Log in to join the conversation.

More
2 months 3 weeks ago #197394 by Fran1991
Thank you very much JOffm.

I think your option is the most feasible.

Thanks for taking the time to help me with my question.

Greetings.

Please Log in to join the conversation.

More
2 months 3 weeks ago #197399 by Fran1991
Hi joffm

Excuse me again
Now I have another problem,
At the time of testing, send me this message:

Sorry, file type (extension:) is not allowed!


What does not allow me to upload any file of any extension and size.

I have tried to activate the survey and it follows the same problem, I found something in this same forum but I do not know if it is itself my version of PHP, currently the versions that I am using are the following:



Should I update the PHP version of the page? or is it some other mistake that I'm just making?

Thanks again for the help.
Attachments:

Please Log in to join the conversation.

More
2 months 3 weeks ago #197404 by Joffm
Replied by Joffm on topic Upload an image to a question


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
2 months 3 weeks ago #197460 by Fran1991
Hello joffm,

I am using the default settings.

png, gif, doc, odt, jpg, pdf, png

Cheers,

Please Log in to join the conversation.

More
2 months 3 weeks ago #197464 by Joffm
Replied by Joffm on topic Upload an image to a question
attach an lss export of your survey.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
2 months 3 weeks ago #197468 by Fran1991
Hi JOffm

I attach the lss export of the survey.

Thank you very much!
Attachments:

Please Log in to join the conversation.

More
2 months 3 weeks ago #197478 by Joffm
Replied by Joffm on topic Upload an image to a question
Hi,
I do not see any issue. So there seems to be something else on your side.


except the missing relevance equation on the "other" and some HTML code inside the question code (hint: curly brackets)



By the way: Which version of LS?


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:

Please Log in to join the conversation.

More
2 months 3 weeks ago #197484 by Fran1991
I don't know what it could be

I was using Version 2.50+ Build 160414 and in this I had no problem uploading the files.

Now what I updated to Version 3.17.5 + 190604 is where I present this error.

I don't know if it has something to do with the PHP version of the page, the one I currently use is the
5.6.40

Cheers

Please Log in to join the conversation.

More
2 months 3 weeks ago #197485 by tpartner

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Attachments:

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now