WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Validate an image type using pathinfo() Function
Categories : PHP, Filesystem Click here to Update Your Picture
Robin Varghese
Date : Mar 21st 2009
Grade : 1 of 5 (graded 3 times)
Viewed : 1514
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Robin Varghese
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?php
//Validate an image type using pathinfo() Function
//$_FILES['sample']['name'] is the name of uploaded file

$info        =    pathinfo($_FILES['sample']['name']);

//pathinfo() function returns an associative array
//$info['extension'] gives value of image type
//For eg.it returns tpe jpg,gif etc

$extension = strtolower($info['extension']);
if(
$extension=="jpg"|| $extension=="jpeg" ||$extension=="pjpeg" || $extension=="bmp" || $extension=="gif" || $extension=="png")
{
       
//Code Here
}
?>
        



Variable serialization and unserialization. Loading and saving variable structures to and from file.
Categories : Arrays, Filesystem, Variables, Strings, PHP
JSON File Upload
Categories : PHP, AJAX, Filesystem
upload function using PHP's FTP abilities.
Categories : PHP, Filesystem, HTML and PHP
Get the correct extension and MIME types of an image, even when the filename is incorrect.
Categories : PHP, Filesystem, General SQL
Directory TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML -
Categories : PHP, Directories, FTP, Filesystem, HTML and PHP
Kasskooye($path) tell you the complete size of a folder
Categories : PHP, Algorithms, Utilities, Filesystem
Email attachment code
Categories : PHP, Email, Filesystem
a file explorer for the web, filesystem php php3 files dirs directories pictures files windows linux system list ls scripts
Categories : PHP, URLs, Directories, Filesystem
Disk Usage, uses UNIX du command.
Categories : Complete Programs, PHP, Filesystem
Show Source with Line Numbers
Categories : PHP, Regexps, Filesystem
include php3 files
Categories : Filesystem, PHP, Apache, Web Servers
grab directory listings into an array the example prints out each subdirectory in the main dir - further work is to be performed on this one
Categories : Filesystem, PHP, Directories, Search, Utilities
Moving folder hierarchy b/w server
Categories : PHP, FTP, Filesystem
How to find the name of the current file?
Categories : PHP, Filesystem, Strings
Search and Replace Text : Searches Files for Specified Text and Replaces It by a Given Text
Categories : PHP, PHP Classes, Search, Filesystem