PHP
  Home arrow PHP arrow File Management with PHP
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

File Management with PHP
By: Murali Dharan.M
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 75
    2004-03-29


    Table of Contents:
  • File Management with PHP
  • Building the Database
  • File_Size() and Display_form Functions
  • The Main Program

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    File Management with PHP
    ( Page 1 of 4 )

    We can find many articles related to uploading, viewing, and downloading files. This article is written on the basic concept of uploading and managing files. File uploading is the process of copying the file from your machine to the remote server. Other users of the same system then share this file by viewing or downloading it. What happens when you upload a file that already exists in the remote folder to which you are uploading?

    While discussing this problem, other issues arise, such as: Should the program allow the user to restore this file or retain the existing file? If the file exists, then should I copy the file as a new version? How do I manage files, if the user uploads files of same name and type more than once?

    Prerequisites
    To understand this article, you should have a fair knowledge of PHP. To run examples given in your machine, you need Apache, PHP, and MySQL installed and configured.

    Here's what we want to accomplish:

    • When a user uploads a file for the first time, the system should upload the file in the specified folder and insert file details (file name, size, and type) in the database table.

    • When the user uploads a file for the second time (the filename has to be the same), the system will compare the size, date and time of the existing file and of the file being uploaded, and automatically assign a new version for the uploaded file if there is a difference. If there is no difference, then the existing file will be retained and a message will be displayed for the user.

    • A check box allows the user to replace the existing file. Clicking this option will replace the existing file. Note that only the latest version of the file can be replaced in this case, and not an older one.

    • The database will maintain file list and version details. Users should be able to view all the versions of a file and download the required version.

    • While displaying the file list, the program displays all the versions of files under one name. For example, if the file name is xyz.doc and its other versions are xyz_VERSION1.doc, xyz_VERSION2.doc, xyz_VERSION3.doc, and so on, the program will display the filename as xyz.doc for all the versions.

    • The program allows users to delete the file. Clicking on delete will ask for confirmation before proceeding.



     
     
    >>> More PHP Articles          >>> More By Murali Dharan.M
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT