易截截图软件、单文件、免安装、纯绿色、仅160KB

php 图片上传类代码

<?
//http://www.jb51.net
class upLoad{
public $length; //限定文件大小
public $file; //判断此类是用于图片上传还是文件上传
public $fileName; //文件名
public $fileTemp; //上传临时文件
public $fileSize; //上传文件大小
public $error; //上传文件是否有错,php4没有
public $fileType; //上传文件类型
public $directory; //
public $maxLen;
public $errormsg;
function __construct($length,$file=true,$directory)
{
$this->maxLen=$length;
$this->length=$length*1024;
$this->file=$file; //true为一般文件,false为图片的判断
$this->directory=$directory;
}
public function upLoadFile($fileField)
{
$this->fileName=$fileField['name'];
$this->fileTemp=$fileField['tmp_name'];
$this->error=$fileField['error'];
$this->fileType=$fileField['type'];
$this->fileSize=$fileField['size'];
$pathSign = DIRECTORY_SEPARATOR; // /
if($this->file) //一般文件上传
{
$path = $this->_isCreatedDir($this->directory);//取得路径
if($path)//http://www.jb51.net
{
$createFileType = $this->_getFileType($this->fileName);//设置文件类别
$createFileName=uniqid(rand()); //随机产生文件名
$thisDir=$this->directory.$pathSign.$createFileName.".".$createFileType;
if(@move_uploaded_file($this->fileTemp,$thisDir)) //把临时文件移动到规定的路径下
{
return $thisDir;
}
}
}else{ //图片上传
$path = $this->_isCreatedDir($this->directory);//取得路径
if($path)//路径存在//http://www.jb51.net
{
$createFileType = $this->_getFileType($this->fileName);//设置文件类别
$createFileName=uniqid(rand());
return
@move_uploaded_file($this->fileTemp,$this->directory.$pathSign.$createFileName.".".$createFileType)
? true : false;
}
}
}
public function _isBig($length,$fsize) //返回文件是否超过规定大小
{
return $fsize>$length ? true : false;
}
public function _getFileType($fileName) //获得文件的后缀
{
return end(explode(".",$fileName));
}
publi


相关文档:

如何用C 编写PHP扩展

PHP取得成功的一个主要原因之一是她拥有大量的可用扩展。web开发者无论有何种需求,这种需求最有可能在PHP发行包里找到。PHP发行包包括支持各种数据库,图形文件格式,压缩,XML技术扩展在内的许多扩展。
  扩展API的引入使PHP取得了巨大的进展,扩展API机制使PHP开发社区很容易的开发出几十种扩展。。扩展主要的思想是 ......

PHP函数ereg与preg的区别

      1、ereg里面是不需要也不能使用分隔符和修饰符的,所以ereg的功能比preg要弱上不少。
  2、关于".":点在正则里面一般是除了换行符以外的全部字符,但是在ereg里面的"."是任意字符,即包括换行符!如果在preg里面希望"."
能够包括换行符,可以在修饰符中 ......

php中使用header函数的http头设置

/ ok
header('HTTP/1.1 200 OK');
//设置一个404头:
header('HTTP/1.1 404 Not Found');
//设置地址被永久的重定向
header('HTTP/1.1 301 Moved Permanently');
//转到一个新地址
header('Location: http://www.example.org/'
);
//文件延迟转向:
header('Refresh: 10; url=http://www.example.org/');
print 'Y ......

PHP写的MD5破解与加密程序

程序代码
<!--p
  if(isset($_POST['md5'])){ //判断$md5是否已设置,如果设置了则执行以下代码。
  if(!is_numeric($_POST['time'])){ //如果没获取到time的值则将time的值设置为30
    $_POST['time'] = 30;
      }
    set_time_limit($_P ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号