放在sae上,在线生成图种。 http://tuzhong.sinaapp.com
-
- require('db.php');
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $stor = new SaeStorage();
-
-
- //确保有足够的空间
- $stor_size=$stor->getDomainCapacity($domain);//获取已用大小
- if($stor_size>=2*1000*1024*1024)
- {
- //删除2个文件
-
- }
-
-
- $bitfile = $_FILES[upfile];
- $picfile = $_FILES[uppic] ;
- if($bitfile['size'] >=1024 * 1024 * 10){
- echo '<script>alert("请上传小于10m的种子文件!")</script>';
- return ;
- }
- if(empty($picfile)){//上传了图片的话
-
- //文件类型为图片,pjpeg为ie中的jpg类型,并且文件大小不得大于10m
- if (in_array($picfile['type'], array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png'))
- && $picfile['size'] <=1024 * 1024 * 10) {
- $fp = fopen($picfile['tmp_name'], "rb");
- $picdata = fread($fp, filesize($picfile['tmp_name']));
-
- }else{
- echo '<script>alert("请上传小于10m的图片!")</script>';
- return ;
- }
- }else{
- //如果没上传文件就使用这一个图片
- $picdata = $stor->read($domain,$BasePicture);
- }
- $fp = fopen($bitfile['tmp_name'],'rb');
- $bitdata = fread($fp,filesize($bitfile['tmp_name']));
-
-
- //合并的临时文件
- $fileName = md5(time()).".png";
- $filePath = SAE_TMP_PATH.$fileName;
-
- $fp = fopen($filePath,'w');
- fwrite($fp,$picdata);
- fwrite($fp,$bitdata);
- fclose($fp);
-
- //上传文件
- $url = $stor->upload($domain,$fileName,$filePath);
-
- echo "<script>window.location.href="down.php?url=$url"</script>";
-
-
- }
-
- ?>
复制代码
|
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31