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
LATEST ARTICLES
replace breaking lines in text or textarea input using php
rounded borders corners css without images
photoshop styles, asl photoshop style free download
excel color code for vba macros
sum if bolded and colored values in excel
set windows xp administrator password
sumif bold value cell in excel
php login script, free login script in php
tooltip files needed tip balloon.js, wz tooltip.js developer
tooltip javascript example html css js tooltips jquery
  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,


google ads




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 latest articles :
• Replace breaking lines in text or textarea input using php
• Rounded borders corners css without images
• Photoshop styles, asl photoshop style free download
• Excel color code for VBA Macros
• SUM IF bolded and colored values in Excel
• Set Windows XP administrator password
• SUMIF bold value cell in excel
• Php Login Script, free login script in php
• Tooltip files needed tip balloon.js, wz tooltip.js developer
• Tooltip Javascript example html css js tooltips JQuery

 

eXTReMe Tracker