代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
PHP
】
图片上传,管理
作者:
Solon.Ring
/ 发布于
2012/3/6
/
620
<div>一开始页面</div> <div></div> <div><script type="text/javascript"></div> <div>//上传图片JS获取图片信息</div> <div>function dianji(v)</div> <div>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>document.getElementById('pic').value=v;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>document.getElementById("show").innerHTML='<img src=\"' + v + '\") onload="javascript:if(this.width>200)this.width=200;">';</div> <div>} <div></script></div> <div></div> <div><input name="pic" id="pic" type="text" value="" style="width:300px;"/></div> <div><span class="Apple-tab-span" style="white-space:pre"> </span><input name="uploadpic" type="button" id="imgFile" value="上 传" onclick="return dopic('upload.php',500,400);"/></div> <div> <div id="show"></div></div> <div></div> <div></div> <div> <div><?php</div> <div>session_start();</div> if(!isset($_SESSION['username'])){echo "<script>alert('Please Login !');location.href='login.php';</script>";} <div>?></div> <div><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></div> <div><style></div> <div>mydiv{ width:460px; height:360px;} <div>ul{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>width:450px;} <div>li{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>list-style-type:none; float:left; padding:4px;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div>li img{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span> cursor:pointer; border:2px #CCC groove} <div>li img:hover{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>cursor:pointer; border:2px #F00 groove} <div>.del{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>padding-left:30px;}<span class="Apple-tab-span" style="white-space:pre"> </span></div> <div>.del a{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>text-decoration:none;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>color:#999;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>font-size:13px;} <div>.del a:hover{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>text-align:center;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>text-decoration:underline;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>background:#F00} <div><span class="Apple-tab-span" style="white-space:pre"> </span></div> <div>changpage{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>text-align:center; margin-top:10px;} <div>changpage a{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>color:#000; text-decoration:none} <div>changpage a:hover{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>color:#F00; text-decoration:underline} <div>up{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>text-align:center;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>background:#CCC;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>margin-top:10px;} <div>.top{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>color:#F00;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>font-size:12px;</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>font-weight:bold;} <div></style></div> <div><script type="text/javascript"></div> <div>function qd(v)</div> <div>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>window.opener.dianji(v);</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>window.close();</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div></script></div> <div><script type="text/javascript" src="base/scripts/erp.js"></script></div> <div><?php</div> if($_GET['del'])</div> <div>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>$dir = 'upload/';</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>if($fileopen = opendir($dir))</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>@unlink($dir.$_GET['del']);</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div><span class="Apple-tab-span" style="white-space:pre"> </span>} <div>?></div> <div><div class="top">如果要使用以经上传的图片,请【单击】你需要的图片</div></div> <div><div id="mydiv"><ul></div> <div><?php</div> <div>$resPath = 'upload/';</div> if ($dh = opendir($resPath))</div> <div>{</div> <div>while (($file = readdir($dh)) !== false)</div> <div>{</div> <div> if($file !='.' and $file !='..' and end(explode('.',$file))!='db')</div> <div> {</div> <div> echo "<li><img src=".$resPath.$file." width=\"120px\" height=\"140px\" title='左击调用图片' onclick=\"return qd('".$resPath.$file."');\"><span class=\"del\"><a onclick=\"return del('".$file."');\" href=\"upload.php?del=".$file."\" >【删除】</a></span></li>";</div> <div> } <div>} <div>closedir($dh);</div> <div>} <div>?></ul></div> <div></div></div> <div><div style="clear:both"></div></div> <div><div id="changpage"></div></div> <div><div id="up"></div> <div><form id="upForm" action="upload_send.php" method="post" enctype="multipart/form-data" onsubmit="return startUpload();"></div> <div><input type="file" name="myfile" id="myfile" /> <input type="submit" name="submitBtn" value="确定上传" /></div> <div></form></div> <div></div></div> <div><script></div> <div>var obj,j;</div> <div>var page=0;</div> <div>var nowPage=0;//当前页</div> <div>var listNum=6;//每页显示<ul>数</div> <div>var PagesLen;//总页数</div> <div>var PageNum=4;//分页链接接数(5个)</div> <div>onload=function(){</div> <div>obj=document.getElementById("mydiv").getElementsByTagName("li");</div> <div>j=obj.length</div> <div>PagesLen=Math.ceil(j/listNum);</div> <div>upPage(0)</div> <div>} <div>function upPage(p){</div> <div>nowPage=p</div> <div>//内容变换</div> <div>for (var i=0;i<j;i++){</div> <div>obj[i].style.display="none"</div> <div>} <div>for (var i=p*listNum;i<(p+1)*listNum;i++){</div> if(obj[i])obj[i].style.display="block"</div> <div>} <div>//分页链接变换</div> <div>strS='<a href="###" onclick="upPage(0)">首页</a> '</div> <div>var PageNum_2=PageNum%2==0?Math.ceil(PageNum/2)+1:Math.ceil(PageNum/2)</div> <div>var PageNum_3=PageNum%2==0?Math.ceil(PageNum/2):Math.ceil(PageNum/2)+1</div> <div>var strC="",startPage,endPage;</div> if (PageNum>=PagesLen) {startPage=0;endPage=PagesLen-1} <div>else if (nowPage<PageNum_2){startPage=0;endPage=PagesLen-1>PageNum?PageNum:PagesLen-1}//首页</div> <div>else {startPage=nowPage+PageNum_3>=PagesLen?PagesLen-PageNum-1: nowPage-PageNum_2+1;var t=startPage+PageNum;endPage=t>PagesLen?PagesLen-1:t} <div>for (var i=startPage;i<=endPage;i++){</div> if (i==nowPage)strC+='<a href="###" style="color:red;font-weight:700;" onclick="upPage('+i+')">'+(i+1)+'</a> '</div> <div>else strC+='<a href="###" onclick="upPage('+i+')">'+(i+1)+'</a> '</div> <div>} <div>strE=' <a href="###" onclick="upPage('+(PagesLen-1)+')">尾页</a> '</div> <div>strE2=nowPage+1+"/"+PagesLen+"页"+" 共"+j+"条"</div> <div>document.getElementById("changpage").innerHTML=strS+strC+strE+strE2</div> <div>} <div></script></div> </div>
试试其它关键字
图片上传
同语言下
.
用net匹配并替换iOS标准的emoji表情符号
.
处理带Emoji表情的的字符串
.
获取微信昵称时 过滤特殊字符
.
通过判断上传文件的头字符来判断文件的类型
.
模拟百度URL加密解密算法
.
以太坊检查地址是否合法
.
实现crontab解析类
.
获取每个月的开始和结束时间
.
图片上传工具类
.
APP手机应用信息采集
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
Solon.Ring
贡献的其它代码
(
2
)
.
自动登录网络设备备份配置文件
.
图片上传,管理
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3