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


PHP upload::uploadFile方法代码示例

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


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

示例1: uploadmulti

/**
 * 上传单个或多个文件
 * @param int $type
 * $type为0:上传图片
 * $type为1:上传视频
 */
function uploadmulti($type)
{
    // 	print_r($_FILES);die;
    $files = getFiles();
    $path = dirname(dirname(__FILE__));
    //获取upload_image的上层目录的绝对路径
    if ($type == 0) {
        $uploadPath = $path . '/upload_image';
    } else {
        $uploadPath = $path . '/upload_video';
    }
    foreach ($files as $fileInfo) {
        $upload = new upload($fileInfo, $uploadPath, false);
        $dest = $upload->uploadFile();
        $uploadFiles[] = $dest;
    }
    $uploadFiles = array_values(array_filter($uploadFiles));
    return $uploadFiles;
}
开发者ID:skdliuyang,项目名称:wechat-subscribe,代码行数:25,代码来源:uploadFiles.php

示例2: uploadmulti

/**
 * 上传单个或多个文件
 * @param int $type
 * $type为0:上传图片
 * $type为1:上传视频
 * $type为2:上传缩略图
 */
function uploadmulti($fileName, $type)
{
    // 	print_r($_FILES);die;
    $files = getFiles();
    if ($type == 0) {
        $uploadPath = '../../../common/upload_image';
    } elseif ($type == 1) {
        $uploadPath = '../../../common/upload_video';
    } else {
        $uploadPath = '../../../common/upload_thumb';
    }
    foreach ($files as $fileInfo) {
        $upload = new upload($fileName, $fileInfo, $uploadPath, false);
        $dest = $upload->uploadFile();
        $uploadFiles[] = $dest;
    }
    $uploadFiles = array_values(array_filter($uploadFiles));
    return $uploadFiles;
}
开发者ID:sunpeijun,项目名称:wechat_subscribe,代码行数:26,代码来源:uploadFiles.php

示例3: upload

<?php

header('content-type:text/html;charset=utf-8');
require_once 'upload.class.php';
//$upload = new upload('myFile1');
$upload = new upload('myFile1', 'test');
$dest = $upload->uploadFile();
echo $dest;
开发者ID:JXHZY,项目名称:webDeveloper,代码行数:8,代码来源:doAction6.php

示例4: unset

     unset($rs);
     $page_nav = multi($total_num, $perpage, $pg, urr("mydisk", "item=profile&action={$action}"));
     require_once template_echo('profile', $user_tpl_dir);
     break;
 case 'invite':
     $invite_url = $settings['invite_register_encode'] ? $settings['phpdisk_url'] . urr("account", "action=register&" . pd_encode('uid=' . $pd_uid)) : $settings['phpdisk_url'] . urr("account", 'action=register&uid=' . $pd_uid);
     // my downlines
     $my_downlines = @$db->result_first("select count(*) from {$tpf}buddys where userid='{$pd_uid}'");
     require_once template_echo('profile', $user_tpl_dir);
     break;
 case 'application_teacher':
     if ($task == 'save_image') {
         //增加保存图片的代码
         require PHPDISK_ROOT . 'includes/class/upload.class.php';
         $upload = new upload('file', APPLICATION_MATERIALS_DIR);
         $fileName = $upload->uploadFile();
         //清除显示
         ob_get_clean();
         echo json_encode(array('status' => 'ok', 'data' => array('filename' => basename($fileName)), 'msg' => '成功上传文件'));
         exit;
     } elseif ($task == 'application_add') {
         //检查是否存在提交的信息
         $application_one = get_application_teacher_status();
         if ($application_one) {
             $sysmsg = array('不能重复申请,请先取消当前教师申请');
             redirect('back', $sysmsg);
             exit;
         }
         //申请提交的代码
         form_auth(gpc('formhash', 'P', ''), formhash());
         $user_name = gpc('user_name');
开发者ID:saintho,项目名称:phpdisk,代码行数:31,代码来源:profile.inc.php

示例5: array

				<input type="file" name="myLogo" accept="image/jpeg,image/gif,image/png"/>
				<br />
				请选择你要上传的excel文件:
				<input type="file" name="myExcel" accept="application/msexcel"/>
				<input type="submit" value="上传信息" />
				<br />
			</form>
		</center>
	</body>
</html>
<?php 
header('content-type:text/html;charset=utf-8');
require_once '../libs/upload.class.php';
require_once '../libs/upload_img.class.php';
require_once '../include.php';
if (!empty($_POST["bookName"])) {
    //上传logo
    $uploadimg = new upload_img("myLogo", "../logo");
    $destexcel_img = $uploadimg->uploadFile();
    //	echo $destexcel_img;
    //录入电话簿数据库
    $phonebook = array("name" => $_POST["bookName"], "intr" => $_POST["intr"], 'logo' => $destexcel_img);
    insert('phonebook', $phonebook);
    //	$sql = "INSERT INTO phonebook (name,intr,logo) VALUES('".$_POST["bookName"]."','".$_POST["intr"]."','".$destexcel_img."')";
    //	  echo $sql.'<br />';
    //     $res = mysql_query($sql);
    //上传excel表并解析
    $uploadexcel = new upload('myExcel', '../excels', '5242880', array('xlsx', 'xls'));
    $destexcel = $uploadexcel->uploadFile(mysql_insert_id());
    //	echo $destexcel;
}
开发者ID:Arc-lin,项目名称:dankal,代码行数:31,代码来源:upload.php


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