Monthly Archives: July 2011

PHP Function To Get File Mime Type

Whenever you need to determine the mime-type of a file you should generally look at the file extension. Below is a pretty straight forward function that will return the mime-type of a file based on its file extension. Note! this is not a guaranteed way to determine the mime-type since people can easily fake the [...]

Use PHP Headers to Force File Download

In apache, the file type will usually determine how the file is handled when viewing a website in our browser. For example, images, css, javascript, php, html (and other types) files are executed and displayed within the browser whereas PDF, ZIP, EXE and other unknown file types will be downloaded by the browser. Usually this [...]

Fastest way to format file size into kilobytes, megabytes and gigabytes

In this short post, you will find a PHP function that has got to be the quickest way to convert bytes into an easier to read format of kilobytes, megabytes, gigabytes and petabytes. The PHP filesize convert function takes the number (as bytes) passed to it and will convert it into an easier to read [...]

Welcome to the Webmaster Blog and Portfolio of Darian Brown

Hello, my name is Darian Brown and this is my webmasters blog and portfolio. It features tutorials, tips and code samples to help you create better websites and teach you techniques which can unlock your true potential to be a better web designer, webmaster and programmer. I will be posting helpful tips, tutorials, techniques and [...]