This document discusses PHP beyond the basics and covers uploading photographs to a server using PHP. It explains that object-oriented programming (OOP) adds complexity for simple sites but necessary simplicity for complex sites. It also provides details about PHP configuration settings for uploading, the $_FILES superglobal variable, and possible error codes for uploads.
This document discusses PHP beyond the basics and covers uploading photographs to a server using PHP. It explains that object-oriented programming (OOP) adds complexity for simple sites but necessary simplicity for complex sites. It also provides details about PHP configuration settings for uploading, the $_FILES superglobal variable, and possible error codes for uploads.
Beyond the Basics PHP is a Server-Side scripting Language
Do we need OOP ?
PHP OOP Rule:
• For a simple site, OOP adds unnecessary complexity.
• For a complex site, OOP adds necessary simplicity.
Contents and Operations :
Uploaded Photographs
Add, Read, Delete operations on the uploaded Photograph
(To maintain Log for the Images in the SERVER)
Comment to the corresponding Photograph
Downloading the Uploaded Photograph
php.ini uploading checklist file_uploads on ( or ‘true’ or ‘1’) upload_temp_dir NULL (uses system’s temp directory) post_max_size 8M upload_max_filesize 2M max_execution _time 30 ( in sec ) max_input_time -1 ( no limit ) memory_limit 128M Additional Super-Global variable : $_FILE[‘form_input’]
Keys in the associative array:
name Original file name
type Mime type (“image/gif”) size Size in bytes tmp_name Temp file name on Server Error Error code List of Errors: UPLOAD_ERR_OK 0 No Error UPLOAD_ERR_INI_SIZE 1 Larger than Upload_max_filesize UPLOAD_ERR_FORM_SIZE 2 Larger than MAX_FILE_SIZE UPLOAD_ERR_PARTIAL 3 Partial Upload UPLOAD_ERR_NO_FILE 4 No File UPLOAD_ERR_NO_TMP_DIR 5 No Temporary Directory UPLOAD_ERR_CANT_WRITE 6 Can’t write to Disk UPLOAD_ERR_EXTENSION 7 File Upload stopped by extension