A Sample File System Application Now that we

A Sample File System Application Now that we have taken a look at the functions that PHP offers for manipulating files in the server’s file system, let’s put it to some practical use. In this section we will develop a small application by first designing it, and then walking through the source code. Online Storage Application One of the most popular web based applications available today is the online storage application. An online storage application allows users to store data on a remote server. The data stored can be viewed and managed from any web browser. We will try to develop a similar application, though not that sophisticated, but good enough to give a good illustration of PHP’s file functions. Let us look at the requirements and design considerations for such an application: . Users should be able to use the application from any web browser supporting HTML 3.2 or later. . New users should be able to register by themselves. . The application should be secure. That is, some basic authentication mechanism will be built into the application, so as to prevent unauthorized persons from accessing the application on a user’s behalf. . Users should be able to create folders. . Users should be able to delete folders. . Users should be able to traverse folders. . Users should be able to upload new files. . Users should be able to view files. . The application should try to use PHP file functions wherever possible. . The application will not deal with concurrency issues. Before looking at the code, let’s first look at the user interface of the application to get a feel for it: This page registers the new users with the application. The user enters their details first name, last name, e-mail address, user name, and password and clicks on the Submit button. Note that the username and password values will be used later for logging on to the application. This is the login page of the application: For logging on, the user enters username and password in the Username and Password text input boxes, and clicks on the Submit button. If the authentication succeeds, then the user is taken to the main page of the application: From the main page of the application the user can do the following: . Create Folder A new sub-folder can be created in the current folder, by entering the name of the sub-folder in the Folder Name text input box and clicking on the Create Folder button. . Remove Folder/File A folder/file can be removed by selecting the folder/file from Select a Folder/File drop box and clicking on the Remove Folder button. . Upload File A file can be uploaded into the current folder, by entering or selecting the file name in the Upload File text input box and clicking on the Upload button: . Traverse folders or view files The left hand side of the main page lists the sub-folders and files in the current directory. The user can traverse or view files, by clicking on the name of the folder/file. . Logout User can logout by clicking on the Logout link. Page 253

Hint: If you are looking for very good and affordable webspace to host and run your j2ee hosting application check Virtualwebstudio j2ee web hosting services

Comments are closed.