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
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 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,






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