当前位置: 首页>>代码示例>>PHP>>正文


PHP qqFileUploader::getSize方法代码示例

本文整理汇总了PHP中qqFileUploader::getSize方法的典型用法代码示例。如果您正苦于以下问题:PHP qqFileUploader::getSize方法的具体用法?PHP qqFileUploader::getSize怎么用?PHP qqFileUploader::getSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qqFileUploader的用法示例。


在下文中一共展示了qqFileUploader::getSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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));
开发者ID:nsystem1,项目名称:OS-MusXpand,代码行数:31,代码来源:picupload.php

示例2: substr

            $ftype = MXMEDIASONG;
            break;
        case 'jpg':
        case 'jpeg':
        case 'png':
        case 'gif':
            $ftype = MXMEDIAPIC;
            break;
        case 'm4v':
        case 'mov':
        case 'avi':
        case 'mpg':
        case 'mpeg':
            $ftype = MXMEDIAVIDEO;
            break;
        default:
            $ftype = MXMEDIAUNDEFINED;
            break;
    }
    //$result=$mxuser->addmedia($uploader->getName(),$uploader->getSize(),0);
    //error_log('calling addmedia');
    $result = $mxuser->addmedia($uploader->getName(), $uploader->getSize(), MXMEDIAVALIDATED, $uploader->getName(), $ftype, $uploader->getName());
    //error_log('back from addmedia');
}
if ($result['error'] && strlen($result['error']) > 160) {
    $result['error'] = substr($result['error'], 0, 160) . '[...]';
}
//error_log('fileupload.php: '.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('fileupload.php return: '.htmlspecialchars(json_encode($result), ENT_NOQUOTES));
开发者ID:nsystem1,项目名称:OS-MusXpand,代码行数:31,代码来源:fileupload.php


注:本文中的qqFileUploader::getSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。