upload php check file extension alowed - php upload - php

upload php check file extension alowed

 
  • HOME  • tutorials  • photos   • free grafics design   
   



CATEGORIES
EXCEL TUTORIAL
SQL TUTORIAL
WEB INFORMATION
WINDOWS
JAVASCRIPT SCRIPTS
COMPUTER SECURITY
GRAFIC DESIGN
HTML
PHP
CSS STYLE
ATLAS OF THE WORLD
DEVELOPER
PHOTOSHOP
MAGAZINE
LATEST ARTICLES
how to insert decimal values into a sql table row
asrep.com adsense traking script is down
list of walt disney animated movies
free php and ajax captcha scripts
convert uppercase to lowercase javascript online script
detect and block uppercase (up letters) in a string (form text input) php script
php googlebot detection script
replace breaking lines in text or textarea input using php
rounded borders corners css without images
photoshop styles, asl photoshop style free download
  home   PHP » UPLOAD PHP CHECK FILE EXTENSION ALOWED
google ads
 
 
 


UPLOAD PHP CHECK FILE EXTENSION ALOWED



STEP 2

Next step is to define the strings for the file extension allowed to be uploaded. Only this extension will be able to move on your server.

For this part you must to create a php page named upload.php in which you have to copy the following lines at the beginning of code .


This part of code validate file extensions to be uploaded via form


//=======================

$extensions = array('.png', '.gif', '.jpg', '.jpeg','.PNG', '.GIF', '.JPG', '.JPEG');
$valid_extensions = '.png , .gif, .jpg, .jpeg';
$extension = strrchr($_FILES['userfile']['name'], '.');

//=======================

You can change alowed extension with your own.







Next step:
copy this code below :


//================

if (!in_array($extension, $extensions))
{
echo'<center>wrong files format , alowed only <strong>"'.$valid_extensions.'"</strong></center>';


//=========================




Note!

$extensions = array('.png', '.gif', '.jpg', '.jpeg','.PNG', '.GIF', '.JPG', '.JPEG');  
we write lower and UPPER leters because some servers do not make the difference ( sensitive case ) 
 


The error message for extension validation will be :

 

wrong files format , alowed only ".png , .gif, .jpg, .jpeg"

!!
You can change the text for this error message but not the part
"'.$valid_extensions.'" ';
 


»
CREATE HTML ( PHP ) FORM
» STEP 2 : VALIDATION PHP : CHECK FILE EXTENSION IF IS  ALOWED / NOT ALLOWED  TO BE UPLOADED
» STEP 3 : VALIDATION PHP : CHECK IF A FILE WITH THE SAME NAME EXIST ON SERVER
» STEP 4 : VALIDATION PHP : CHECK THE FILE MAXIMUM SIZE
» STEP 5 : MOVE UPLOAD FILE IN UPLOAD DIRECTORY ON SERVER
» STEP 6: DEMO PAGE -PHP UPLOAD SCRIPT IN ACTION
» STEP 7: DOWNLOAD THE SCRIPT
 


ARTICLES IN UPLOAD PHP CHECK FILE EXTENSION ALOWED CATHEGORY

Zero result!!



Tags : php upload extension validation,validate extension upload php script,






Leave a comment
Your name *
E-mail * ( it not be posted)
Comment title *
Your comment *
   Anti Spam (fill the number CASE SENSITIVE - UP LETTERS ) *

There are no comments ...The page was not find

 

 

the latest articles :
• How to insert decimal values into a SQL table row
• Asrep.com adsense traking script is down
• List of Walt Disney animated movies
• Free PHP and AJAX CAPTCHA scripts
• Convert uppercase to lowercase javascript online script
• Detect and block uppercase (up letters) in a string (form text input) php script
• Php Googlebot detection script
• Replace breaking lines in text or textarea input using php
• Rounded borders corners css without images
• Photoshop styles, asl photoshop style free download

 

eXTReMe Tracker