Welcome Guest, Not a member yet? Register   Sign In
Getting path/URL of uploaded files
#1

Hey guys, I hope you're doing alright in this pandemic.

I've searched the forums and StackOverflow but I can't seem to find solutions to what I believe is a very simple concept: is there a method that returns the full path/URL of the uploaded file?

Here's what my flow looks like:
1. Image is uploaded via a form.
2. Image is moved using '$file->store()'
3. The value returned is inserted into the database (e.g. "20200626/1593171870_2ebce4905386e30800cf.jpeg")

I'm unable to build a path/URL that can display the image in another controller. I've tried 'realpath()' in combination with 'APPPATH', 'WRITEPATH', and the value attained in step 3 but I'm given 404 errors. An example:
Code:
http://localhost:8080/Users/path/to/app/writable/uploads/20200626/1593171870_2ebce4905386e30800cf.jpeg
 I guess the error makes sense because it points to the system path.

So, how does one point to the path/URL of an uploaded file in CI?

Thanks for taking time to read this.
Reply


Messages In This Thread
Getting path/URL of uploaded files - by dariusbaker - 06-26-2020, 06:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB