本文整理汇总了PHP中qqFileUploader::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP qqFileUploader::getName方法的具体用法?PHP qqFileUploader::getName怎么用?PHP qqFileUploader::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qqFileUploader
的用法示例。
在下文中一共展示了qqFileUploader::getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
/**
* @brief Accion que se encarga de manipular el proceso de guardar
* un archivo en el servidor
* @param array $allowedExtensions Arreglo de extensiones validas para el archivo
* @param int $sizeLimit Tamaño maximo permitido del fichero que se sube
*/
function upload($allowedExtensions, $sizeLimit = 10485760)
{
jimport('Amadeus.Util.Uploader');
$media =& JComponentHelper::getParams('com_media');
$postSize = $this->toBytes(ini_get('post_max_size'));
$uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
$mediaSize = (int) $media->get('upload_maxsize');
// Se selecciona el minimo tamaño válido para un fichero, de acuerdo
// a los valores configurados en el php, el joomla y el componente.
$sizeLimit = min($postSize, $uploadSize, $mediaSize, $sizeLimit);
// Se alamacena la imagen en la ruta especificada
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload(JPATH_SITE . '/tmp/', true);
if (!isset($result['error'])) {
jimport('Amadeus.Util.Validation');
$file = $uploader->getName();
$result = AmadeusUtilValidation::isValidFile($file, $only_image);
if (isset($result['error'])) {
jimport('joomla.filesystem.file');
if (!JFile::delete($file)) {
$result = array('error' => JText::_('DELETEERROR'));
}
} else {
$this->_file = $file;
}
}
return $result;
}
示例2: upload
public function upload()
{
require_once 'qqFileUploader.php';
$uploader = new qqFileUploader();
$uploader->inputName = 'qqfile';
// Set the allowed file types based on config.
$allowedFileTypes = C("plugin.Attachments.allowedFileTypes");
if (!empty($allowedFileTypes)) {
$uploader->allowedExtensions = $allowedFileTypes;
}
// Set the max file size based on config.
if ($size = C("plugin.Attachments.maxFileSize")) {
$uploader->sizeLimit = $size;
}
// Generate a unique ID and secret for this attachment.
$attachmentId = uniqid();
$secret = generateRandomString(13, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
$name = $uploader->getName();
// Save it to the filesystem.
$model = ET::getInstance("attachmentModel");
$result = $uploader->handleUpload($model->path(), $attachmentId . $secret);
if (!empty($result["success"])) {
$result['uploadName'] = $uploader->getUploadName();
// Save attachment information to the session.
$session = (array) ET::$session->get("attachments");
$session[$attachmentId] = array("postId" => R("postId"), "name" => $name, "secret" => $secret);
ET::$session->store("attachments", $session);
}
header("Content-Type: text/plain");
echo json_encode($result);
}
示例3: VALUES
INSERT INTO `' . _DB_PREFIX_ . 'videos_tab_mod`
(`id_product`, `type`, `video`) VALUES(
' . intval(Tools::getValue('id_product')) . ', 0,
\'' . urldecode(Tools::getValue('embedCode')) . '\')');
$last_id = Db::getInstance()->Insert_ID();
$data = array();
$data['id'] = $last_id;
$data['video'] = Tools::getValue('embedCode');
if ($query) {
print json_encode($data);
}
}
if (Tools::getValue('action') == 'submitUploadVideo' && Tools::getValue('id_product')) {
$allowedExtensions = array("mp4");
$sizeLimit = 10485760;
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload('uploads/');
$filename = $uploader->getName();
if (isset($result['success'])) {
$query = Db::getInstance()->Execute('
INSERT INTO `' . _DB_PREFIX_ . 'videos_tab_mod`
(`id_product`, `type`, `video`) VALUES(
' . intval(Tools::getValue('id_product')) . ', 1,
\'' . $result['filename'] . '\')');
$last_id = Db::getInstance()->Insert_ID();
$result['id_video'] = $last_id;
print json_encode($result);
} else {
print json_encode($result);
}
}
示例4: array
(at your option) any later version.
musxpand is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with musxpand. If not, see <http://www.gnu.org/licenses/>.
Copyright � 2010 by Philippe Hilger
*/
include_once 'includes/mx_init.php';
require_once 'ext_includes/fileuploader.php';
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
$allowedExtensions = array('jpg', 'jpeg', 'png', 'gif');
// max file size in bytes
$sizeLimit = 10 * 1024 * 1024;
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
//$userdir = mx_option('usersdir').'/'.$mxuser->hashdir;
//$mxuser->checkuserdir();
$result = $uploader->handleUpload(mx_option('usersdir') . '/tmp/', true);
error_log(print_r($result, true));
if (!array_key_exists('error', $result)) {
$result = $mxuser->addmedia($uploader->getName(), $uploader->getSize(), MXMEDIAREADY, 'Profile Pic', MXMEDIAPIC, $uploader->getName());
//$result['error']=$result['link'];
}
//error_log(print_r($result,true));
// to pass data through iframe you will need to encode all html tags
print_r(htmlspecialchars(json_encode($result), ENT_NOQUOTES));
//error_log('picupload return: '.htmlspecialchars(json_encode($result), ENT_NOQUOTES));
示例5: time
mx_setsession($mxuser, time() + 1200);
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
$allowedExtensions = array('mp3', 'jpg', 'jpeg', 'png', 'gif', 'doc', 'pdf', 'm4v', 'mp4', 'mov');
// max file size in bytes
$sizeLimit = MXMAXFILESIZE;
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
// --- removed to save to a global /users/tmp dir on the web server, then addmedia moves to S3
//$userdir = mx_option('usersdir').'/'.$mxuser->hashdir;
//$mxuser->checkuserdir();
//$result = $uploader->handleUpload($userdir.'/tmp/',true);
// --- end
//error_log("before upload\n");
$result = $uploader->handleUpload(mx_option('usersdir') . '/tmp/', true);
//error_log("after upload\n");
if (!array_key_exists('error', $result)) {
switch (strtolower(pathinfo($uploader->getName(), PATHINFO_EXTENSION))) {
case 'mp3':
case 'mp4':
$ftype = MXMEDIASONG;
break;
case 'jpg':
case 'jpeg':
case 'png':
case 'gif':
$ftype = MXMEDIAPIC;
break;
case 'm4v':
case 'mov':
case 'avi':
case 'mpg':
case 'mpeg':
示例6: json_encode
<?php
/**
* 上传调用文件
*/
header('Content-Type:text/html;charset=utf-8');
//引入核心类
require_once 'qqFileUploader.php';
$uploader = new qqFileUploader();
//制定上传文件的扩展名 ex. array("jpeg", "xml", "bmp")
$uploader->allowedExtensions = array('jpg');
//留空可以允许所有文件
//设置上传文件字节大小
$uploader->sizeLimit = 10 * 1024 * 1024;
// 指定在JavaScript中输入名称。
//Specify the input name set in the javascript.
$uploader->inputName = 'qqfile';
// 如果你想使用恢复功能,上传,指定要保存的文件夹。
//If you want to use resume feature for uploader, specify the folder to save parts.
$uploader->chunksFolder = 'chunks';
// 以指定的名称保存上传,的第二个参数设置。
//To save the upload with a specified name, set the second parameter.
$result = $uploader->handleUpload('uploads/', $uploader->getName());
//已引用入口文件地址为准
//返回一个用于上传文件,你可以使用下面的行名称。
//To return a name used for uploaded file you can use the following line.
$result['uploadName'] = $uploader->getUploadName();
header("Content-Type: text/plain");
echo json_encode($result);
示例7: upload
/**
* @brief Accion ecargada de manipular el archivo que se esta cargando.
*
* Las validaciones se hacen con respecto a las configuraciones provistas
* por el Joomla en su seccion "Configuracion Multimedia". Si la variable
* \a only_image se encuentra con un valor verdadero, solo se permitira subir
* archivos de tipo imagen, en caso contraro, archivos validos.
*/
function upload()
{
$media =& JComponentHelper::getParams('com_media');
$only_image = JRequest::getVar('only_image', '');
if ($only_image == true) {
$allowedExtensions = explode(',', $media->get('image_extensions'));
} else {
$allowedExtensions = explode(',', $media->get('upload_extensions'));
}
/// Se selecciona el menor valor para subir archivos, ya sea el configurado por el
/// servidor o el configurado en el Joomla
$postSize = $this->toBytes(ini_get('post_max_size'));
$uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
$sizeLimit = (int) $media->get('upload_maxsize') * 1048576;
$sizeLimit = min($postSize, $uploadSize, $sizeLimit);
require_once JPATH_COMPONENT . DS . 'uploader.php';
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload(JPATH_SITE . '/tmp/', true);
if (!isset($result['error'])) {
jimport('Amadeus.Util.Validation');
$file = $uploader->getName();
$result = AmadeusUtilValidation::isValidFile($file, $only_image);
if (isset($result['error'])) {
jimport('joomla.filesystem.file');
if (!JFile::delete($file)) {
$result = array('error' => JText::_('DELETEERROR'));
}
}
}
echo htmlspecialchars($this->encodeJSON($result), ENT_NOQUOTES);
}
示例8: upload
public function upload()
{
require('Public/qqFileUploader.php');
$uploader = new \qqFileUploader();
// Specify the list of valid extensions, ex. array("jpeg", "xml", "bmp")
$uploader->allowedExtensions = array("apk", "ipa", "zip");
// Specify max file size in bytes.
$uploader->sizeLimit = 100 * 1024 * 1024;
// Specify the input name set in the javascript.
$uploader->inputName = 'qqfile';
// If you want to use resume feature for uploader, specify the folder to save parts.
$uploader->chunksFolder = 'chunks';
// Call handleUpload() with the name of the folder, relative to PHP's getcwd()
//$result = $uploader->handleUpload('Uploads');
$ext = getFileExt($uploader->getName());
$platform = getPlatformType($uploader->getName());
$filename = $platform .'_'. time().'_'.mt_rand().'.'.$ext;
// To save the upload with a specified name, set the second parameter.
//$result = $uploader->handleUpload($this->upload, $filename);
if($ext == 'zip')
{
$filename = $uploader->getName();
}
$result = $uploader->handleUpload($this->upload, $filename);
// To return a name used for uploaded file you can use the following line.
$result['uploadName'] = $uploader->getUploadName();
header("Content-Type: text/plain");
echo json_encode($result);
}
示例9: qqFileUploader
<?php
require "../engineInclude.php";
require "../header.php";
define('UPLOAD_PATH', files::getBaseUploadPath());
define('PERMISSONS', 0777);
// Include the uploader class
recurseInsert("includes/class.fineUploader.php", "php");
$uploader = new qqFileUploader();
// Specify the list of valid extensions, ex. array("jpeg", "xml", "bmp")
$uploader->allowedExtensions = array();
// Specify the input name set in the javascript.
$uploader->inputName = 'qqfile';
// Preserve the file's extention for Mime-Type stuff
$filename = $uploader->getName();
$fileExt = "." . pathinfo($filename, PATHINFO_EXTENSION);
// To save the upload with a specified name, set the second parameter.
$uploadPath = UPLOAD_PATH . DIRECTORY_SEPARATOR . $engine->cleanPost['MYSQL']['uploadID'];
// Make sure the upload temp dir exits
if (!is_dir($uploadPath)) {
mkdir($uploadPath, PERMISSONS, TRUE);
} else {
if (!$engine->cleanPost['MYSQL']['multiple']) {
$files = glob($uploadPath . DIRECTORY_SEPARATOR . '*');
// get all existing file names
foreach ($files as $file) {
if (is_file($file)) {
unlink($file);
}
}
}