本文整理汇总了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));
示例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));