Welcome Guest, Not a member yet? Register   Sign In
anchor for file in WRITEPATH
#4

(09-17-2022, 12:58 AM)captain-sensible Wrote: from a form
Code:
  $file = $this->request->getFile('userfile');

//line in form is
<input type="file" name="userfile" size="20" required/>
//then in controller

$file = $this->request->getFile('userfile');
      $name= $file->getName();

So now we have the name of the file with its extension.

you could save that info into a database,  even with a slug name if required;to retrieve later  and since you know where you put it you have:

name of file
location of file

for a download link for a specfic pdf in routes i have :
Code:
$routes->get('linkPdf/(:segment)','ProducePDF::getPdf/$1');
and in a view(with an a href  link)  i display something like :

https://myweb/linkPdf/Adinkra-symbols-of-Ghana

//So using the slug : Adinkra-symbols-of-Ghana  i can query a db and get Id,  path to image etc

that should give you something to think around

so  linkPdf/Adinkra-symbols-of-Ghana  goes to  ProducePDF::getPdf

where ProducePdf is a class and getPdf is one of its methods that does all the work.

And to force download of a file ?
Reply


Messages In This Thread
anchor for file in WRITEPATH - by pippuccio76 - 09-16-2022, 12:51 PM
RE: anchor for file in WRITEPATH - by InsiteFX - 09-17-2022, 12:32 AM
RE: anchor for file in WRITEPATH - by pippuccio76 - 09-17-2022, 02:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB