previousExtensive information about uploaded files (Previous) (Next) Imagesnext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Internationalized Error Messages

Another handy feature of HTTP_Upload is support for internationalized error messages. This means that if an error (like an invalid file upload) is detected, the programmer can choose in which the language the error messages should be returned by HTTP_Upload.

The first parameter of the constructor method for HTTP_Upload determines the language to be used. This is illustrated in the following example:

Example

<?php
// German error messages
$language "de";

require_once 
"HTTP/Upload.php";

$upload = new HTTP_Upload($language);
$file $upload->getFiles("f");

if (
$file->isValid()) {
    
$moved $file->moveTo("uploads/");
    if (!
PEAR::isError($moved)) {
        echo 
"File was moved to uploads/";
    } else {
        
// This will print a german error message
        
echo "An error was detected: " $moved->getMessage() . "<br />";
    }
}
?>
previousExtensive information about uploaded files (Previous) (Next) Imagesnext

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.