#native_company# #native_desc#

File Version Management in PHP Page 3

By M. Murali Dharan
on January 14, 2004

File Upload Manager

This program displays a menu to select the file in your system, a check box, and Upload button.

Once when the user clicks the upload button, the program checks the file for existence, and undergoes series of tests as described in the plan.

Now lets look upon the code snippets…

$dir_path Variable

This variable is the destination folder path.

$dir_path= “C:apachehtdocsfilemanager”;

This path is given for a Windows based system. Please change your destination folder accordingly.

Get_New_File_Name() Function

This function is called from the main program when the program encounters file exists and difference in size, date or time. This function will generate a new file name and return to the main function.


function Get_New_File_Name($file_name)


        $sqlQuery="SELECT  file_image_name 

               FROM file_manager 

               WHERE  file_name LIKE '$file_name%'

             AND  file_parent_id=1"








$Last_Version $Last_Version $ver $Last_Version $ver;



$new_file_name =$file_name."_VERSION".++$Last_Version;



    if($Last_Version !=0){