![]() |
How to display uploaded file from writable/uploads - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: How to display uploaded file from writable/uploads (/showthread.php?tid=93031) |
How to display uploaded file from writable/uploads - paulgough - 06-17-2025 Hello, I have a question. In CodeIgniter 4, how can I display the path of an uploaded file from the writable/uploads folder? I upload various file types including images, documents, PDFs, and CSVs using the following code and store the file paths in the database. Code: $file->move(WRITEPATH . 'uploads', $fileName); All uploaded records are listed on a page, and I need to open the uploaded CSV or Excel files in a new tab from this listing page. However, I’m unable to retrieve the path from the writable/uploads folder to open it in a new tab. Code: <?=WRITEPATH.'uploads/'.$allList->documentCsv?> When I copy the link and try to open it in a new tab, it downloads instead of displaying the file. Could you please explain how to properly show the file path? RE: How to display uploaded file from writable/uploads - InsiteFX - 06-17-2025 This may get you going in the right path. PHP Code: // In your controller or a suitable method |