php图片上传代码_PHP教程

php中文网
发布: 2016-07-20 11:09:03
原创
1772人浏览过

php图片上传代码/*这款国外的php图片上传代码是一款好的文件与图片上传代码,并且还支持文件在线管理哦,是一款比较的好图片管理系统哦。

php教程图片上传代码
/*
这款国外的php图片上传代码是一款好的文件与图片上传代码,并且还支持文件在线管理哦,是一款比较的好图片管理系统哦。
*/

 define('max', 2);  mysql教程_connect('localhost', 'your mysql username', 'your mysql password'); mysql_select_db('your mysql database');  switch ($_post['action']) {  case 'upload':     $file = $_files['file']['tmp_name'];   $filename = $_files['file']['name'];      if($file) {       $max = max * 1024 * 1024;    $q = mysql_query("select * from `uploads` order by `batch` desc limit 1");    $r = mysql_fetch_assoc($q);    $batch = $r['batch'];        if($filename == 'upload.zip') {         $zip = zip_open($file);     if ($zip) {           while ($zip_entry = zip_read($zip)) {              $size = zip_entry_filesize($zip_entry);              $name = zip_entry_name($zip_entry);              $type = substr(strrchr($name, '.'), 1);              if (zip_entry_open($zip, $zip_entry, "r")) {               $content = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));        zip_entry_close($zip_entry);                 }           if ($size > $max) {               header('location: ./?error=4');        exit;               }              $error = true;              if ($type == 'gif' && $error) {               $error = false;               }              if ($type == 'png' && $error) {               $error = false;               }              if ($type == 'jpg' && $error) {               $error = false;               }              if ($type == 'jpeg' && $error) {               $error = false;               }              if ($error) {               header('location: ./?error=2');               } else {               $id = 1;        $batch2 = $batch + 1;                while (file_exists("uploads/$id/$name")) {                 $id++;                 }        @mkdir("uploads/$id");                $fp = @fopen("uploads/$id/$name", "w");                if (@fwrite($fp, $content)) {                 $q = mysql_query("insert into `uploads` (`file`, `batch`) values ('uploads/$id/$name', '$batch2')");         $id = mysql_insert_id();                 } else {                 header('location: ./?error=3');                 }                fclose($fp);               }           }            header('location: ./?batch=' . $batch2);            zip_close($zip);          }        } else {         if (filesize($file) > $max) {           header('location: ./?error=4');      exit;           }          $error = true;          if (@imagecreatefromjpeg($file) && $error) {           $error = false;           }          if (@imagecreatefromgif($file) && $error) {           $error = false;     }          if (@imagecreatefrompng($file) && $error) {           $error = false;           }          if ($error) {           header('location: ./?error=2');           } else {           $id = 1;      $batch = $batch + 1;            while (file_exists("uploads/$id/$filename")) {             $id++;             }      @mkdir("uploads/$id");            if (@move_uploaded_file($file, "uploads/$id/$filename")) {             $q = mysql_query("insert into `uploads` (`file`, `batch`) values ('uploads/$id/$filename', '$batch')");       $id = mysql_insert_id();       header('location: ./?image=' . $id);             } else {             header('location: ./?error=3');             }           }        }       } else {       header('location: ./?error=1');      }      exit;     break; }  header('content-type: text/html; charset=iso-8859-1'); ob_start('rewrite'); function rewrite ($buffer) {  $host = $_server['http_host'];  $path = dirname($_server['php_self']);  $absolute = "http://$host$path/";  return preg_replace('#(href|src|action)="/#', "1="$absolute", $buffer); } ?>    jpegr - share photos instantly                           quick upload              upload   help   terms of service          images hosted      help                  how do i upload an image?      just use the quick upload form on the top, or goto the home page to upload an image.                what does "you must select a file to upload!" mean?      this means that you clicked upload without selecting an image file.                what does "that is a not a valid jpeg, gif, or png image." mean?      this means that you uploaded a file, but it was not a jpeg, gif, or png image.                what does "there was a problem with the server, and we were unable to upload your image." mean?      this means your file was accepted, but it did not get saved, you will need to try again, or upload another image.                what does "the file you selected was too big, mb is the maximum." mean?      this means that you tried to upload a file that was too big.               terms of service       when you upload to jpegr you agree to the following;         you will not use jpegr to upload pornographic content, any violation of this agreement may result in ban, and immediate removal of content.     you will not abuse jpegr's upload form.     any violation may result in permanent ban.       

源码下载地址

http://down.php100.com/php/2010/0927/20956.html

jQuery PHP图片批量上传代码
jQuery PHP图片批量上传代码

jQuery PHP图片批量上传代码

jQuery PHP图片批量上传代码 100
查看详情 jQuery PHP图片批量上传代码

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/444844.htmlTechArticlephp图片上传代码/*这款国外的php图片上传代码是一款好的文件与图片上传代码,并且还支持文件在线管理哦,是一款比较的好图片管理系统哦...
相关标签:
php
PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号