Reputation: 1
I want to upload a PHP file to a server under a PNG extension, while still being able to view it in my browser as a PHP file. How can I do that? Thanks.
Upvotes: 0
Views: 886
Reputation: 2936
Use the following in your .htaccess file in the directories where your files are:
<FilesMatch "\.png$">
SetHandler application/x-httpd-php
</FilesMAtch>
Note that ALL files with .png will be handled by PHP with this.
Upvotes: 3
Reputation: 5335
You can add AddType application/x-httpd-php .png to an .htaccess file (assuming your host allows you to use .htaccess files), and Apache will send those file off to be parsed by PHP.
Upvotes: 1
Reputation: 3300
You cannot. PHP is server-side code and is not rendered in the browser.
Upvotes: -1