We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Image upload not load from url

Hello everybody, in my app has a session in which the user uploads an image, this save image direct on folder 'public/uploads'. Ok is working perfect, but when I'm showing the image like <img src='uploads/imageuploaded.jpg' .../> it is not loaded. I try show image from browser: https://mydomain.com/uploads/imageuploaded.jpg and response: UploadsController handler class cannot be loaded

Any idea?

Phalcon thinks you're trying to access controller. It's a problem in your webserver configuration. What webserver are you using?

I'm using Apache 2. Strange that I copied the image uploaded to the directory 'public/images' where has some app images. And I get ImagesController handler class cannot be loaded but "logo.png" load OK in same folder.



85.5k

i think you are missing this in your .htaccess

RewriteCond %{REQUEST_FILENAME} !-f

what it does is : if the request is a file, just serve it back.

My full host config :

RedirectMatch 204 /robots.txt
RedirectMatch 204 /favicon.ico

DirectoryIndex index.php

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?s).*)$ index.php?_url=/$1 [QSA,L]

What OS you are using?

Sorry guy, but I was trying to load the file did not exist. It was just a mistake when making md5 string in the user's e-mail. Thanks.