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
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号