News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

C. Sadeesh Kumar's Blog:
Smart File Type Detection Using PHP
August 29, 2011 @ 12:07:53

In a new post today C. Sadeesh Kumar has a quick tip to help your script detect file types without having to rely on the extension to be correct.

In most web applications today, there is a need to allow users to upload images, audio and video files. Sometimes, we also need to restrict certain types of files from being uploaded - an executable file being an obvious example. Security aside, one might also want to prevent users from misusing the upload facility, e.g. uploading copyrighted music files illegally and using the service to promote piracy! In this article, we'll look into a few ways in which we can achieve this.

The trick to his example is in using the Fileinfo PECL extension. With the help of this extension you can look inside the file and pick out the "magic bytes" (the first few bytes of a file) and see what MIME type the file really is. He includes a simple example of using the extension on a file and a file upload script that checks the type and handles the file accordingly.

0 comments voice your opinion now!
file type detection fileinfo extension pecl tutorial


Johannes Schluter's Blog:
A hidden gem in PHP 5.3 fileinfo
December 17, 2008 @ 09:35:59

Johannes Schluter has pointed out a "hidden gem" for PHP 5.3 in his latest blog post - the fileinfo extension.

This series is not meant to be complete but some personal choice, these blog postings are also no replacement for documentation, but just pointers. My goal is that you try out 5.3 right now so we can fix bugs as soon as possible before releasing it The NEWS file has a quite short entry for my first subject: Added fileinfo extension as replacement for mime_magic extension. (Derick)

He looks at one situation where the extension could come in very handy - getting the content type of the file for a download push - as well as why its better than the older mime_content_type function.

0 comments voice your opinion now!
php5 gem fileinfo mimecontenttype function extension hidden


Zend Developer Zone:
Zend Weekly Summaries Issue #322
January 29, 2007 @ 12:27:00

The latest weekly summary for the PHP mailing lists has been posted over on the Zend Developer Zone. This week, discussions included:

  • Sandboxed semaphores
  • Focus on *printf [continued]
  • PHP 5.2.1 RC2 and PHP 4.4.5 RC1
  • It's all in the HEAD
Descriptions of each of the headings are provided, including code and a "short version" for those on the run.

Be sure to check back each week for a new summary.

0 comments voice your opinion now!
zend weekly summary semaphore fileinfo relrease fastcgi head openssl zend weekly summary semaphore fileinfo relrease fastcgi head openssl


Ilia Alshanetsky's Blog:
GDChart & Fileinfo Releases
January 04, 2006 @ 06:48:21

According to this new post from Ilia Alshanetsky's blog, he's wrapped up new versions of his PECL extensions, Fileinfo and GDChart.

Just finished packaging Fileinfo 1.0.3 that finally builds on both PHP 5.1 and 5.0 properly. You can download the new version by running "pecl install fileinfo" or download the tgz file from here.

I've also made the release of GDChart 0.2 that is nearly a complete rewrite of the extension, originally written by Rasmus that allows it to work with PHP 5.1. This extension wraps around the bundled gdchart library and allows you with just a few lines of code draw 20 different graphs types.

The GDChart package looks especially useful, making it a simple matter of feeding in the data you want to render and out popps a graph. Previously, there's been this functionality via other scripts, but it's nice to see something native...

0 comments voice your opinion now!
pecl fileinfo gdchart new releases pecl fileinfo gdchart new releases



Community Events





Don't see your event here?
Let us know!


laravel unittest application release install code library wordpress language framework podcast threedevsandamaybe interview api introduction developer series configure list community

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework