Welcome to the LimeSurvey Community Forum

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

get_uploaded_files method

  • fellipeguerra1
  • fellipeguerra1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 10 months ago #184755 by fellipeguerra1
get_uploaded_files method was created by fellipeguerra1
Im trying to use this function in my code, this is the result:
Code:
fu_mnipg9i8h4qictx  
meta  
size  "82.698"
name  "Curr%C3%ADculo%20Pedro%20.pdf"
filename  "fu_mnipg9i8h4qictx"
ext  "pdf"
content  "JVBERi0xLjMKJcTl8uXrp/Og…HhyZWYKODEwMDAKJSVFT0YK"

how can i put this file using zipArchive?

i tried:
Code:
$zip = new ZipArchive();
        $getp = self::$lime->get_uploaded_files(
                self::$sessionKey,
                self::$survey_id,
                'tt');
 
 
                 $zip->open("anexo.zip", ZipArchive::CREATE);
                 $zip->addFile($getp);
                 $zip->close();
                 $header['Content-Type'] = 'application/zip';
return response()->download("anexo.zip", "anexo.zip", $header);

I believe it is not that way, could anyone help me?
thank you anyway.
The topic has been locked.
  • fellipeguerra1
  • fellipeguerra1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 10 months ago #184759 by fellipeguerra1
Replied by fellipeguerra1 on topic get_uploaded_files method
update:
Code:
$zip->open("anexo.zip", ZipArchive::CREATE);
 
 
                foreach($getp as $_uploaded_file_info) {
                  $zip->addFromString($_uploaded_file_info['meta']['name'], base64_decode($_uploaded_file_info['content']));
 
                }
                $zip->close();
                $header['Content-Type'] = 'application/zip';
 
                return response()->download("anexo.zip", "anexo.zip", $header);


A question:
Code:
  $getp = self::$lime->get_uploaded_files(
                self::$sessionKey,
                self::$survey_id,
                $stoken);

is stoken only accept not null values?

regards,
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose