Help: Apache ForceType

Status
Not open for further replies.

sangsang13080198

New Member
Messages
1
Reaction score
0
Points
0
Hello,

i've got problems trying to ForceType a particular png image to execute as a PHP script. When browsing the link, the file itself popup and tries to download it. Here is my .htaccess code.

Code:
<Files myfile.png>
ForceType application/x-httpd-php
</Files>
i also tried with ForceType application/x-httpd-php5 and it fails me. Also on my actual script (i.e. myfile.png) i have my headers set to output as PNG.
Code:
header("Content-type: image/png");
Thanks and waiting for reply.

P.s: i'm on a free hosting account on stoli.
 

descalzo

Grim Squeaker
Community Support
Messages
9,372
Reaction score
326
Points
83
I don't think that is possible with the way PHP is run on the servers. People have tried to use Apache directives in .htaccess to make the server parse .html files as PHP with no success.

Maybe try:

Rename the file from myfile.png to myfile.php. My guess is that it is actually a PHP file and that it sets the headers to the correct Content-type (or you could just add the code to do it).

Use mod_rewrite to change requests for myfile.png to a request for myfile.php
 
Last edited:
Status
Not open for further replies.
Top