本文整理汇总了PHP中upload::save_urlfile方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::save_urlfile方法的具体用法?PHP upload::save_urlfile怎么用?PHP upload::save_urlfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类upload
的用法示例。
在下文中一共展示了upload::save_urlfile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter_images
function filter_images($folder, $linkanh)
{
global $global_config, $module;
if (!file_exists(NV_UPLOADS_REAL_DIR . '/' . $module . "/" . $folder)) {
nv_mkdir(NV_UPLOADS_REAL_DIR . '/' . $module, $folder);
}
$path = NV_UPLOADS_DIR . "/" . $module . "/" . $folder . "";
require_once NV_ROOTDIR . "/includes/class/upload.class.php";
$upload = new upload(array('images'), $global_config['forbid_extensions'], $global_config['forbid_mimes'], NV_UPLOAD_MAX_FILESIZE, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$upload_info = $upload->save_urlfile($linkanh, NV_ROOTDIR . '/' . $path, false);
$home_file = $folder . "/" . $upload_info['basename'];
sleep(1);
return $home_file;
}
示例2: die
if (!isset($check_allow_upload_dir['upload_file'])) {
die("ERROR_" . $lang_module['notlevel']);
}
if (!isset($_FILES, $_FILES['fileupload'], $_FILES['fileupload']['tmp_name']) and !$nv_Request->isset_request('fileurl', 'post')) {
die("ERROR_" . $lang_module['uploadError1']);
}
if (!isset($_FILES) and !nv_is_url($nv_Request->get_string('fileurl', 'post'))) {
die("ERROR_" . $lang_module['uploadError2']);
}
require_once NV_ROOTDIR . "/includes/class/upload.class.php";
$upload = new upload($admin_info['allow_files_type'], $global_config['forbid_extensions'], $global_config['forbid_mimes'], NV_UPLOAD_MAX_FILESIZE, NV_MAX_WIDTH, NV_MAX_HEIGHT);
if (isset($_FILES['fileupload']['tmp_name']) and is_uploaded_file($_FILES['fileupload']['tmp_name'])) {
$upload_info = $upload->save_file($_FILES['fileupload'], NV_ROOTDIR . '/' . $path, false);
} else {
$urlfile = trim($nv_Request->get_string('fileurl', 'post'));
$upload_info = $upload->save_urlfile($urlfile, NV_ROOTDIR . '/' . $path, false);
}
if (!empty($upload_info['error'])) {
die("ERROR_" . $upload_info['error']);
}
if ($upload_info['is_img']) {
$autologomod = explode(',', $global_config['autologomod']);
$dir = str_replace("\\", "/", $path);
$dir = rtrim($dir, "/");
$arr_dir = explode("/", $dir);
if ($global_config['autologomod'] == 'all' or $arr_dir[0] == NV_UPLOADS_DIR and isset($arr_dir[1]) and in_array($arr_dir[1], $autologomod)) {
$upload_logo = '';
if (file_exists(NV_ROOTDIR . '/' . $global_config['upload_logo'])) {
$upload_logo = $global_config['upload_logo'];
} elseif (file_exists(NV_ROOTDIR . '/' . $global_config['site_logo'])) {
$upload_logo = $global_config['site_logo'];
示例3: createthumb
$thumbpath = NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_name . '/' . $type . '/' . $data[$typeid]['imgfolder'] . '/thumbs/';
if (!file_exists($thumbpath . '/' . $upload_info['basename'])) {
$imgdata['thumbpath'] = createthumb($imgpath, $thumbpath, '', 180, 180);
}
$src = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $type . '/' . $data[$typeid]['imgfolder'] . '/' . $upload_info['basename'];
$lu = strlen('.' . $upload_info['ext']);
$alias = substr($upload_info['basename'], 0, -$lu);
$alias = np_get_alias('photos', 0, $alias);
$imgdata['pid'] = 'NULL';
$imgdata['filename'] = $upload_info['basename'];
$imgdata['filetype'] = $upload_info['mime'];
$imgdata['filepath'] = $type . '/' . $data[$typeid]['imgfolder'];
$imgdata[$main] = intval($typeid);
$imgdata[$second] = 0;
$imgdata['alias'] = $imgdata['title'] = $alias;
$imgdata['img_size'] = $upload_info['img_info'][0] . '-' . $upload_info['img_info'][1];
$pid = $np->addItem('photos', $imgdata);
if ($type == 'category' and $pid > 0) {
$imgdata['pid'] = $pid;
$np->addItem($typeid, $imgdata);
}
}
} else {
$urlfile = trim($nv_Request->get_string('fileurl', 'post'));
$upload_info = $upload->save_urlfile($urlfile, NV_ROOTDIR . '/' . NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_name, false);
}
if (!empty($upload_info['error'])) {
die("nperror*" . $upload_info['error'] . "*");
} else {
die("success*Upload thành công*" . $pid . "*" . $src);
}
示例4: array
if ($type == 'image' and in_array('images', $admin_info['allow_files_type'])) {
$allow_files_type = array('images');
} elseif ($type == 'flash' and in_array('flash', $admin_info['allow_files_type'])) {
$allow_files_type = array('flash');
} elseif (empty($type)) {
$allow_files_type = $admin_info['allow_files_type'];
} else {
$allow_files_type = array();
}
require_once NV_ROOTDIR . '/includes/class/upload.class.php';
$upload = new upload($allow_files_type, $global_config['forbid_extensions'], $global_config['forbid_mimes'], NV_UPLOAD_MAX_FILESIZE, NV_MAX_WIDTH, NV_MAX_HEIGHT);
if (isset($_FILES['upload']['tmp_name']) and is_uploaded_file($_FILES['upload']['tmp_name'])) {
$upload_info = $upload->save_file($_FILES['upload'], NV_ROOTDIR . '/' . $path, false, $global_config['nv_auto_resize']);
} else {
$urlfile = rawurldecode(trim($nv_Request->get_string('fileurl', 'post')));
$upload_info = $upload->save_urlfile($urlfile, NV_ROOTDIR . '/' . $path, false, $global_config['nv_auto_resize']);
}
if (!empty($upload_info['error'])) {
$error = $upload_info['error'];
} elseif (preg_match('#image\\/[x\\-]*([a-z]+)#', $upload_info['mime'])) {
if ($global_config['nv_auto_resize'] and ($upload_info['img_info'][0] > NV_MAX_WIDTH or $upload_info['img_info'][0] > NV_MAX_HEIGHT)) {
require_once NV_ROOTDIR . '/includes/class/image.class.php';
$createImage = new image(NV_ROOTDIR . '/' . $path . '/' . $upload_info['basename'], $upload_info['img_info'][0], $upload_info['img_info'][1]);
$createImage->resizeXY(NV_MAX_WIDTH, NV_MAX_HEIGHT);
$createImage->save(NV_ROOTDIR . '/' . $path, $upload_info['basename'], 90);
$createImage->close();
$info = $createImage->create_Image_info;
$upload_info['img_info'][0] = $info['width'];
$upload_info['img_info'][1] = $info['height'];
$upload_info['size'] = filesize(NV_ROOTDIR . '/' . $path . '/' . $upload_info['basename']);
}