Welcome Guest, Not a member yet? Register   Sign In
external request for a file gives 404
#8

(05-27-2025, 10:17 AM)grimpirate Wrote: Try the inline download method instead of creating your own response and see if that works for you.
PHP Code:
<?php

namespace App\Controllers;

class 
RenderImage extends BaseController // extend the BaseController not the system framework controller
{
    public function index($tmpdir,$image)
    {
        $path TMP_IMAGE_UPLOAD.$tmpdir.'/'.$image;
        if(FALSE === file_exists($path))
            throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound(); // not sure what your show_404 function does or where it comes from, but I imagine this is what it's doing

        return $this->response->download($pathnull)->inline();
    }



OK tried that. In my own browser it downloads the image and I can open it and see it.
However when WebPurify try to get the image for moderation I see this in the logs:


c2-54-176-221-19.us-west-1.compute.amazonaws.com - - [27/May/2025:19:06:37 +0100] "HEAD /imageRender/dtPWxMe3Feax/IMG_1887.JPG HTTP/1.1" 404 4178 "-" "python-requests/2.18.4"
ec2-54-176-221-19.us-west-1.compute.amazonaws.com - - [27/May/2025:19:06:37 +0100] "GET /imageRender/dtPWxMe3Feax/IMG_1887.JPG HTTP/1.1" 404 5608 "-" "python-requests/2.18.4"

Any ideas please?
Reply


Messages In This Thread
external request for a file gives 404 - by PaulC - 05-22-2025, 01:06 AM
RE: external request for a file gives 404 - by PaulC - 05-27-2025, 11:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB