Presentation is loading. Please wait.

Presentation is loading. Please wait.

File Uploads. The Form tag Set the method to “post” The form attribute enctype="multipart/form- data” must be in the opening form tag Before the file.

Similar presentations


Presentation on theme: "File Uploads. The Form tag Set the method to “post” The form attribute enctype="multipart/form- data” must be in the opening form tag Before the file."— Presentation transcript:

1 File Uploads

2 The Form tag Set the method to “post” The form attribute enctype="multipart/form- data” must be in the opening form tag Before the file field you must have a hidden field with a name of MAX_FILE_SIZE and the max size of the file in bytes The file field displays differently in different browsers.

3 Folder Permissions The folder you are adding images to must be writable by the web server. The web server runs as the user apache and is a different user then you are. You must set the permissions to 777 or rwxrwxrwx on the folder you are going to save in. In this case the images folder. Use FileZilla or Cyberduck to set the permissions and NOT the Mac interface.

4 Global Variables The file is accessed through the global variable $_FILES If the file form element is called userfile then the file is referenced with $_FILES[“userfile”] It will be a multi-dimensional array with four sub keys of name, temp_name, size and type.

5 Simple move You can use the PHP command move_uploaded_file to transfer the temp file to its new location. If the temp file is not transferred before the end of the script executing the temp file is automatically deleted.

6 GD GD is an extension of PHP that allows you to modify images. It has basic functionality as compared to Imagemagick.


Download ppt "File Uploads. The Form tag Set the method to “post” The form attribute enctype="multipart/form- data” must be in the opening form tag Before the file."

Similar presentations


Ads by Google