会员登录 | 会员注册 | 意见建议 | 网站地图

站长资源综合门户

当前位置:首页 > 站长学院 > 编程程序 > PHP非常实用的上传类,上传效果在线演示

PHP非常实用的上传类,上传效果在线演示

时间:2012-08-11 17:34:09   作者:   来源:   点击:

{

$this ->

createfolder(''.$_YL_UPLOAD['file_urldirectroy'].''.$yl_file_path.'');//创建目录

}

//检查目录写权限

if

(

href="[email=!@is_writable(]!@is_writable(''.$_YL_UPLOAD['file_urldirectroy'].''.$yl_file_path.''" _cke_saved_href="[email=!@is_writable(]!@is_writable(''.$_YL_UPLOAD['file_urldirectroy'].''.$yl_file_path.''">mailto:!@is_writable(''.$_YL_UPLOAD['file_urldirectroy'].''.$yl_file_path.''">!@is_writable(''.$_YL_UPLOAD['file_urldirectroy'].''.$yl_file_path.''[/email]))

{

$this ->

alert("上传目录没有写权限!");

exit;

}

$yl_path_name

=

''.$_YL_UPLOAD['file_urldirectroy'].''.$yl_file_path.'/'.$yl_filenamenewsext.'';

$yl_doupload = $this -> yl_upfile($yl_tmp_name, $yl_path_name);

if($yl_doUpload === false){

$this -> alert("上传失败!");

exit;

}else{

//echo

'上传成功';

//echo

'
';

/*

echo

'原文件名:'.$yl_filename.'';

echo

'
';

echo

'新文件名及目录:'.$yl_file_path.'/'.$yl_filenamenewsext;

echo

'
';

echo

'文件大小:'.$yl_file_size.'';

echo '
';

echo '文件类型:'.$yl_file_type.'';

*/

$_YL_UPLOAD['yl_filename'] = $yl_filename;

$_YL_UPLOAD['yl_attachment'] = ''.$yl_file_path.'/'.$yl_filenamenewsext.'';

$_YL_UPLOAD['yl_filesize'] = $yl_file_size;

$_YL_UPLOAD['yl_filetype'] = $yl_file_type;

//检查是否图片

if(@getimagesize($yl_path_name))

{

$_YL_UPLOAD['yl_isimage'] =

1;

///生成缩略图

if ($this -> makethumb($yl_path_name)){

$_YL_UPLOAD['yl_isthumb'] = 1;

}else{

$_YL_UPLOAD['yl_isthumb'] = 0;

}

}else{

$_YL_UPLOAD['yl_isimage'] = 0;

}

}

return

true;

}

#*********************************************************

#提示

#*********************************************************

function

alert($yl_msg)

{

echo '';

echo '';

echo '';

echo '';

echo '';

echo '';

echo ' <script></script>';

echo '';

echo '';

exit;

}

}

分享到:

网友评论

热门编程程序