Welcome to the LimeSurvey Community Forum

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

Upload an image to a question

  • Fran1991
  • Fran1991's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #197315 by Fran1991
Upload an image to a question was created 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. :)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #197330 by tpartner
Replied by tpartner on topic Upload an image to a question

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Fran1991
  • Fran1991's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #197374 by Fran1991
Replied by Fran1991 on topic Upload an image to a question
Thanks, I'll take a look
The topic has been locked.
  • Fran1991
  • Fran1991's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago - 3 years 11 months ago #197381 by Fran1991
Replied by Fran1991 on topic Upload an image to a question
a
Last edit: 3 years 11 months ago by Fran1991.
The topic has been locked.
  • Fran1991
  • Fran1991's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago - 3 years 11 months ago #197383 by Fran1991
Replied by Fran1991 on topic Upload an image to a question
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.
Last edit: 3 years 11 months ago by Fran1991.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago - 3 years 11 months 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".
manual.limesurvey.org/Question_type_-_Fi...m_number_of_files.29

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 11 months ago by Joffm.
The topic has been locked.
  • Fran1991
  • Fran1991's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #197394 by Fran1991
Replied by Fran1991 on topic Upload an image to a question
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.
The topic has been locked.
  • Fran1991
  • Fran1991's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #197399 by Fran1991
Replied by Fran1991 on topic Upload an image to a question
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.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #197404 by Joffm
Replied by Joffm on topic Upload an image to a question
Which file types did you set to be allowed?

manual.limesurvey.org/Question_type_-_Fi...allowed_filetypes.29

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Fran1991
  • Fran1991's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #197460 by Fran1991
Replied by Fran1991 on topic Upload an image to a question
Hello joffm,

I am using the default settings.

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

Cheers,
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months 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
The topic has been locked.
  • Fran1991
  • Fran1991's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #197468 by Fran1991
Replied by Fran1991 on topic Upload an image to a question
Hi JOffm

I attach the lss export of the survey.

Thank you very much!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose