The Main Program
When you execute file_upload_manager.php, the following code is executed first and other function described above are called in the middle of the program.
Once the user selects the file and clicks upload, the main program part is executed. Here the program gets the upload file information like file size, file type, date modified and time stamp.
Next, it checks for the file existence in the destination folder. If the file is present the if part of the program gets executed otherwise the file is copied to the destination folder and the file information is inserted in the database.
If the file exists, and if the file size and time stamp differ, Get_New_File_Name() function is called to generate a new file name. Then the file is copied to the destination folder and the file information is stored in the database.
If the file exists and the user had checked the “Replace Existing File” option, the file is replaced and the file information is updated in the database accordingly. Otherwise the user is redirected to file_display_manager.php page and a message ??????A previous version of this file exists?????? is displayed.