--- Marian Briones <[EMAIL PROTECTED]> wrote: > I posted yesterday and no one answered; I"m wondering if this > list is having tech difficulties....
Your message came through but perhaps people were busy. I know I was (and still am). However, to briefly address your question I offer the following. Like $_POST and $_GET, $_FILES is a superglobal which is intended to collect information received from a particular input stream. In this case, the $_FILES contains data relevant to uploaded files. This associative array has a first key which corresponds to the name of the variable in your upload form. In the example below, the name of the uploaded file is myfile so the portion of the array is $_FILES['myfile']. <form method='post' action='script.php' enctype='multipart/form-data'> <input type='file' name='myfile'> <input type='submit'> </form> You should make a test script with a simple form and in the PHP which is identified in the action parameter of the form tag you can display the variables available during your upload: <pre> The $_FILES array contains: <?php print_r($_FILES); ?> </pre> When a file is uploaded you will see the following values: $_FILES['myfile']['name'] // name of the original file $_FILES['myfile']['size'] // size in bytes of the file $_FILES['myfile']['type'] // MIME type of the file $_FILES['myfile']['tmp_name'] // path to temporary file $_FILES['myfile']['error'] // error code (0=no error) You will have to consult one of these specific values to see if your file was uploaded. Keep in mind that several of these values may not be trustworthy. For example, the MIME type could be faked by the uploading computer so use a server-based verification that the item is really an image (such as the getimagesize() function). File uploads are very risky if not handled carefully. You are basically allowing unknown web users the ability to place files of any type on your server. Two newer functions were added to PHP to help ensure that the data you think is a file was an actual upload: http://www.php.net/is_uploaded_file http://www.php.net/move_uploaded_file They should be used instead of the old copy() and unlink() method seen in old tutorials and scripts on file uploads. There is also good information on: http://us3.php.net/manual/en/features.file-upload.php James _____ James D. Keeline http://www.Keeline.com http://www.Keeline.com/articles http://Stratemeyer.org http://www.Keeline.com/TSCollection http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc. Fall Semester Begins Sep 7 -- New Classes Start Every Few Weeks. Spring Semester Begins in late January. Two new class topics. Community email addresses: Post message: [email protected] Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
