Assignment 08

Assignment 08 - User-defined functions...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
User-defined functions Assignment 08 PHP File Upload Program Note extra PHP commands at the end. Due Midnight Thursday March 27 th - 35 Points -- NO EXTENSIONS Purpose of Problem This is intended to increase your experience with PHP and a special type of HTML Form. It also provides opportunities for careful testing of a simple application. MIME types are introduced and a Unix administrative setup program must be run that sets the access privileges of a directory. Proposed Problem 1. Define HTML Form to upload a file to your web server. 2. The Form should allow the user to determine whether to overwrite an existing file of the same name on the server or not based on a radio button choice provided on the Form whose value is passed to and utilized by the PHP program. If an overwrite option is selected and the file already exists then the user should be told it was not overwritten. 3. A password should be required to authorize an upload request. The password can be stored in the PHP program or in a database. Extra credit if you store the user password in a database. 4. The allowed file types that can be uploaded should be .doc or .gif -- all of size less than 30 KB . Other types of files should be rejected. The behavior of the program should be tested to verify it accepts and rejects files appropriately. 6. The program should echo back a description of the results – for example that the password was rejected, or the file was too large, or the file type was not accepted, or there was an error in the file upload, or an existing file was overwritten. 1. The temporary file created by the system when the file is initially uploaded should be renamed to match the original uploaded file name. 2. Possible test cases include: file with same name already exists valid file type but file too large 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
You should thoroughly understand how the code works – both the HTML Form and the PHP code and syntax -- as well as the administrative Setup script that must first be executed on your AFS account in order to establish write access privileges for Upload. The issues involved in uploading files using Forms and PHP are described in the following. Uploading files using PHP There are several requirements to upload a file: 1. The directory the file is stored in must be given HTTP write permission . 2. A special HTML Form must be defined that uses type file. 3. The PHP program must move the uploaded file from its temporary name and location to the target directory 1. Setup AFS Directory Permissions The following Unix administrative program must be run on your account to set the access permissions on a target directory in order to allow writing to it from the PHP program. For simplicity, we have named the target directory upload (this name is not a keyword and we could use another name) that lies in the JUNKY folder of the public_html directory:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 8

Assignment 08 - User-defined functions...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online