Source for file file.json.php
Documentation is available at file.json.php
* @package Joomla.Administrator
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
jimport('joomla.filesystem.folder');
* @package Joomla.Administrator
// Check for request forgeries
'error' =>
JText::_('JINVALID_TOKEN')
JLog::addLogger(array('text_file' =>
'upload.error.php'), JLog::ALL, array('upload'));
// Get some data from the request
$file =
$this->input->files->get('Filedata', '', 'array');
$folder =
$this->input->get('folder', '', 'path');
$_SERVER['CONTENT_LENGTH'] >
($params->get('upload_maxsize', 0) *
1024 *
1024) ||
$_SERVER['CONTENT_LENGTH'] > (int)
(ini_get('upload_max_filesize')) *
1024 *
1024 ||
$_SERVER['CONTENT_LENGTH'] > (int)
(ini_get('post_max_size')) *
1024 *
1024 ||
$_SERVER['CONTENT_LENGTH'] > (int)
(ini_get('memory_limit')) *
1024 *
1024
'error' =>
JText::_('COM_MEDIA_ERROR_WARNFILETOOLARGE')
// Set FTP credentials, if given
// Make the filename safe
if (isset
($file['name']))
JLog::add('Invalid: ' .
$filepath .
': ' .
$err, JLog::INFO, 'upload');
// Trigger the onContentBeforeSave event.
$object_file->filepath =
$filepath;
$result =
$dispatcher->trigger('onContentBeforeSave', array('com_media.file', &$object_file, true));
// There are some errors in the plugins
JLog::add('Errors before save: ' .
$object_file->filepath .
' : ' .
implode(', ', $object_file->getErrors()), JLog::INFO, 'upload');
'error' =>
JText::plural('COM_MEDIA_ERROR_BEFORE_SAVE', count($errors =
$object_file->getErrors()), implode('<br />', $errors))
JLog::add('File exists: ' .
$object_file->filepath .
' by user_id ' .
$user->id, JLog::INFO, 'upload');
'error' =>
JText::_('COM_MEDIA_ERROR_FILE_EXISTS')
elseif (!$user->authorise('core.create', 'com_media'))
// File does not exist and user is not authorised to create
JLog::add('Create not permitted: ' .
$object_file->filepath .
' by user_id ' .
$user->id, JLog::INFO, 'upload');
'error' =>
JText::_('COM_MEDIA_ERROR_CREATE_NOT_PERMITTED')
if (!JFile::upload($object_file->tmp_name, $object_file->filepath))
JLog::add('Error on upload: ' .
$object_file->filepath, JLog::INFO, 'upload');
'error' =>
JText::_('COM_MEDIA_ERROR_UNABLE_TO_UPLOAD_FILE')
// Trigger the onContentAfterSave event.
$dispatcher->trigger('onContentAfterSave', array('com_media.file', &$object_file, true));
'error' =>
JText::_('COM_MEDIA_ERROR_BAD_REQUEST')
Documentation generated on Tue, 19 Nov 2013 15:03:01 +0100 by phpDocumentor 1.4.3