| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
FileSystem |
JFile |
upload |
upload() |
Never | Work in Progress |
Moves an uploaded file to a destination folder.
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. |
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.