oListManager.GetFileRowHtml = function(fileN
ame, fileUrl, fileSize) {
// Build the link to view the folder.
VAR sLink = '<a
href="
#" mce_href="#" onclick="O
PEnFile('' +
PRotectPath(fileUrl) + '');return false;">选择</a>';
// Get the file icon.
var sIcon = oIcons.GetIcon(fileName);
return '<div class="piclist"><
img alt="" src="' + fileUrl + '" src2="images/icons/' + sIcon + '.gif" h
eight="100" border="0"><p>' + sLink + ' <a href="#" mce_href="#" onclick="deleteFile('' + ProtectPath(fileUrl) + '');" style="color: #FF9933;" mce_style="color: #FF9933;"> 删除 </a></p></div>'
}
//******************************** 图片删除功能 ******************************************
var req; //定义变量,用来创建
XMlhttprequest对象
//产生不重复的随机数
var rn = Math.ceil(Math.random() * 1000000);
var rnch = rn;
function rndnum() {
while (rn
== rnch) rn = Math.ceil(Math.random() * 1000000);
rnch = rn;
return rn;
}
// 删除文件,Ajax
开始 function deleteFile(file) {
var url = "/aja
xpic.php?filePath=" + escape(file) + "&am
p;UD=" + rndnum(); //要请求的服务端地址
if (window.XMLHttpRequest) //非IE浏览器及IE7(7.0及以上版本),用xmlhttprequest对象创建
{
req = new XMLHttpRequest();
}
else if (window.ActiveXObject) //IE(6.0及以下版本)浏览器用activexobject对象创建,如果用户浏览器禁用了ActiveX,可能会失败.
{
req = new ActiveXObject("Microsoft.XMLHttp");
}
if (req) //成功创建xmlhttprequest
{
req.open("GET", url, true); //与服务端建立连接(请求方式post或get,地址,true表示异步)
req.onready
statechange = callback; //指定回调函数
req.send(null); //发送请求
}
}
function callback() {
if(req.responseText ==1 )
{
alert('删除成功!');
Refresh();
}
else
{
alert('删除失败!');
}//刷新一下
}
<?
$root = dirname(
__FILE__ );
$filePath = isset(
$_GET['filePath'] ) ?$_GET['filePath']:'';
if( unlink( $root.$filePath) )
{
echo '1';
}
else
{
echo '0';
}
?>