Lecture 14 - Uploading files and PHP graphics

Lecture 14 - Uploading files and PHP graphics - Reminder...

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

View Full Document Right Arrow Icon
1 Uploading files and PHP graphics INFO/COM S 230: Intermediate Web Design and Programming Reminder Project 3, part I due tonight at midnight Midterm info Time: 7:30-9PM, Tuesday 3/11 Place: Olin 155 Format: On paper Closed book, closed notes However, you can bring a 4”x6” index card of notes you made yourself (front and back). Coverage: Up to (and including) Monday’s lecture on logins Review session Sunday, March 9 4-6PM Room: TBA Note: This is optional . Section Will distribute • Lecture evaluation form • Form to help us put together final project groups – Group sizes 3-4 – You can request to be in a group with someone else (from same section time), and we’ll respect it if the choice is mutual Uploading files Easy PDF Creator is professional software to create PDF. If you wish to remove this line, buy it now.
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 How to upload a file As you might suspect, file uploading is another HTML form. <form action=“photoadmin.php” method=“post” enctype="multipart/form-data”> <input type=“file” name=“newphoto” /> <input type=“submit” name=“Upload photo” /> </form> But what is on other side? Accessing the file Unlike other form data, information from file uploading shows up in $_FILES (rather than $_POST or $_GET). $_FILES[‘newphoto’][‘name’] – original name of file $_FILES[‘newphoto’][‘tmp_name’] – name of file in temporary storage $_FILES[‘newphoto’][‘size’] – size in bytes of file $_FILES[‘newphoto’][‘type’] – type of file (e.g. “image/jpeg” or “application/pdf”) $_FILES[‘newphoto’][‘error’] – error code (0 if no error) Moving the file move_uploaded_file( source , destination ) Moves uploaded file out of temporary storage to wherever you want to keep it E.g. move_uploaded_file($_FILES[‘newphoto’][‘tmp_name’], “images/”.$_FILES[‘newphoto’][‘name’]); Another useful function getimagesize( filename ) Returns an array with various information about an image file. E.g. $array = getimagesize(“myphoto.jpg”);
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.

This note was uploaded on 04/01/2008 for the course INFO 2300 taught by Professor Williamson during the Spring '08 term at Cornell University (Engineering School).

Page1 / 6

Lecture 14 - Uploading files and PHP graphics - Reminder...

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