upload php check the file name duplicat - php

upload php check the file name duplicat

 
  • 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 THE FILE NAME DUPLICAT

google ads
 


UPLOAD PHP CHECK THE FILE NAME DUPLICAT



STEP 3
CHECK THE DUPLICAT NAME OF FILES ON YOUR SERVER


If we don't do this validation on upload script we will have a unpleasant situation . A file with the same name will be rewritten into the upload folder with the new one. To avoid such situations we have to do the following validation:



First we have to replace the empty space from name of files in upload.php  
 
//==================

$file_name = $_FILES['userfile']['name'];
$file_name = str_replace(' ', '_', $file_name);

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

 

Then we will check the existence of a file with the same name:
 


//==================
if (file_exists('upload/' .$file_name))
{
echo'The file <strong>"'.$_FILES['userfile']['name'].'"</strong>already exist to our server<br>You have to rename the file in your pc!';
//===================



Also we can adding to the name of file a character or something to differentiate it from the existing duplicate file .
 

//===============
if (file_exists('upload/' .$file_name))
{
$file_name = $file_name.'something_here';
}
//===============






NOTE:
Replacing empty spaces with " _  " . can be necessary when you linking to a uploaded file. The empty spaces can generate  big problems ...

you can use also  "-" 


 
» 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 7: DOWNLOAD THE SCRIPT



ARTICLES IN UPLOAD PHP CHECK THE FILE NAME DUPLICAT CATHEGORY

Zero result!!



Tags : upload duplicate files in php,


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