Archive for November, 2006

} fclose($fp); } include_once(”main.php”); ?> Uploading Files The

Wednesday, November 22nd, 2006

} fclose($fp); } include_once(”main.php”); ?> Uploading Files The uploadfile.phpcopies the uploaded file in the current folder: Sample mimeTypesfile: Page 270

Hint: If you are looking for high quality and reliable webspace provider to host and run your jsp hosting application check Virtualwebstudio jsp web hosting provider

if (!isSessionAuthenticated()) { sendErrorpage(”User session has expired. Please

Wednesday, November 22nd, 2006

if (!isSessionAuthenticated()) { sendErrorpage(”User session has expired. Please login again”); exit; } if (is_dir(getAbsolutePath($currentFolder . “/” . $foldName))) { If $foldName is a folder then delete the folder: if (deleteFolder($currentFolder, $foldName) < 0) { sendErrorPage("Internal Error: Could not delete folder " . $foldName); exit; } } else { If $foldName is a file then delete the file: if (deleteFile($currentFolder, $foldName) < 0) { sendErrorPage("Internal Error: Could not delete file " . $foldName); exit; } Remove the entry of the file from mimeTypes: // Remove the entry of the file from the mimeTypes $mimeTypeFile = getAbsolutePath($currentFolder . "/" . "mimeTypes"); if (($fileContent = file($mimeTypeFile)) == null) { sendErrorPage("Internal Error: Could not read file " . $mimeTypeFile); exit; } if (($fp = fopen($mimeTypeFile, "w")) <= 0) { sendErrorPage("Internal Error: Could not open file " . $mimeTypeFile); exit; } for($i=0; $i < sizeof($fileContent); $i++ ) { $line = trim($fileContent[$i]); list ($fileName, $mimeType) = split(":", $line); if ($fileName != $foldName) { fwrite($fp, $fileContent[$i]); } Page 269

Hint: This post is supported by Gama hrvatski web hosting services

Creating Folders The following file createfolder.phpcreates a new

Wednesday, November 22nd, 2006

Creating Folders The following file createfolder.phpcreates a new folder in the current folder: Removing a Folder/File The following file removefolder.phpdeletes a folder/file from the current folder:

Hint: This post is supported by Gama web hosting hrvatska services

Generate HTML element for all the elements, except

Wednesday, November 22nd, 2006

Generate HTML n”); } } ?>

The following is an HTML form for uploading a file to the current folder. The action of the form is the uploadfile.phpfile and the enctype attribute of the form element is set to multipart/form-data:

Upload File

Page 267

Note: If you are looking for good and affordable webspace to host and run your servlet application check Virtualwebstudio servlet hosting services

closedir($dir) ?> The following HTML form is for

Wednesday, November 22nd, 2006

closedir($dir) ?>


The following HTML form is for creating a new folder. The action of the form is the createfolder.phpscript:

The form variable foldName holds the value of the new folder’s name:

Create Folder
Folder Name:

Below is the HTML form for deleting an element of the current folder. The action of the form is removefolder.php:

Remove Folder/File Select a Folder/File: Select element for displaying the elements of the current folder:

The following file (login.php) does the user authentication. If the authentication succeeds then it displays the main page, otherwise it displays the error page: Note: If you are looking for cheap and quality provider to host and run your java application check Astra java hosting services