6 months ago

Accessing an uploaded public file

Posted 6 months ago by cservices

I'm having an issue with uploaded files and accessing them.

I have set the storage:link.

When saving a file that has been uploaded do I need to specify public like this?

$file->storeAs($path, $machine_file_name, 'public'); $path is a directory.

This saves the file at "storage/app/public/dirname/filename".

I want to access this file in a couple of ways.

  1. To pass the path to a script - For example: I want to send an uploaded PDF file to a script that will parse it into a string and save that string to a database. I don't want to send the contents, only the path. The script will read the contents.

  2. I want to link to the file for download

Please advise how I can do this.

Thanks, Cy

Please sign in or create an account to participate in this conversation.