Table of Contents

upload

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage FileSystem Class JFile Method upload Reference upload() Never Work in Progress

Moves an uploaded file to a destination folder.

Syntax

boolean upload ( $src, $dest )

$src string is a string containing the name of the PHP (temporary) uploaded file.
$dest string is a string containing the path (including filename) to move the uploaded file to.

Examples

Example: This example copies the temporary file sent in the upload variable.

Example

$file = JRequest::getVar( 'upload', '', 'file', 'array' );

if (!JFile::upload($file['tmp_name'], $destDir.strtolower($file['name']))) {
    echo "Upload failed!";
} else {
    echo "Upload complete!";
}

NOTE: This example is taken from the admin.media.php file in the /administrator/components/com_media directory. This example did not work on the machine on which it was tested.