php文件上传类
<?php
/**
* PHP100.com - 个人感觉非常简单,只要有点PHP基础滴人都应该能看懂~~
* Apache2 + PHP5.0
* Version:1.0
* 同时感谢PHP100所有的兄弟们
* ————————————————————————————————— Example —
* test.php @ 处理表单文件名
* <?php
*
* include("upload.php"); # 加入类文件
* $f_upload = new upload_other; # 创建对象
* $f_upload->set_file_type($_FILES['src']['type']); # 获得文件类型
* $f_upload->set_file_name($_FILES['src']['name']); # 获得文件名称
* $f_upload->set_file_size($_FILES['src']['size']); # 获得文件尺寸
* $f_upload->set_upfile($_FILES['src']['tmp_name']); # 服务端储存的临时文件名
* $f_upload->set_size(100); # 设置最大上传KB数
* $f_upload->set_base_directory("uploadImages"); # 文件存储根目录名称
* $f_upload->set_url("up.php"); # 文件上传成功后跳转的文件
* $f_upload->save(); # 保存文件
*
* ?>
* —————————————————————————————————— End —
*
* 偶没有
相关文档:
看到同学们有不少在用php开发项目的,或许下面的资料对大家有用吧,用来学习一下也好。
收集的资料相关地址:
cubi demo site:http://dev.openbiz.cn/cubi/user/login
openBiz app cubi:http://docs.google.com/View?id=df5ktjv9_64f9fd88gf
openbiz architecture overview:
http: ......
1. PHP可阅读随机字符串
此代码
将创建一个可阅读的字符串,使其更接近词典中的单
词,实用且具有密码验证功能。
/**************
[email=*@length]*@length[/email] - length of random string (must be a
multiple of 2)
**************/
function readable_random_string($length = 6){
$conso= ......
1.页面之间无法传递变量
get,post,session在最新的php版本中自动全局变量是关闭的,所以要从上一页面取得提交过来得变量要使用$_GET['foo'],$_POST['foo'],$_SESSION['foo']来得到。当然也可以修改自动全局变量为开(php.ini改为register_globals = On);考虑到兼容性,还是强迫自己熟悉新的写法比较好。
2.Win32 ......
用PHP实现进度条效果。
<?php
set_time_limit(0);
echo '<h2>正在安装,请稍后...</h2>',
'<div style="border:1px solid #000;width:500px;"><div id="progress_bar">loading...</div></div>';
for($i=1;$i<=100;$i++){
$width = '500';
......
文件php.ini放入windows下,将下面内容拷贝到记事本命名为php.ini放入c:/windows下,重启Apache server:
[PHP]
;;;;;;;;;;;
; WARNING ;
;;;;;;;;;;;
; This is the default settings file for new PHP installations.
; By default, PHP installs itself with a configuration suitable for
; development purposes ......