function show_file($add_file) { $files = array_filter(explode(';', $add_file)); foreach ($files as $file) { if (strlen($file) > 1) { $model = M("File"); $where['sid'] = array('eq', $file); $File = $model->where($where)->field("name,size,extension")->find(); echo '<div class="attach_file" style="background-image:url(__PUBLIC__/ico/ico_' . strtolower($File['extension']) . '.jpg); background-repeat:no-repeat;"><a target="_blank" href="__URL__/down/attach_id/' . f_encode($file) . '">' . $File['name'] . ' (' . reunit($File['size']) . ')' . '</a>'; echo '</div>'; } } }
?> " add_file="<?php echo $file["sid"]; ?> " size="<?php echo $file["size"]; ?> " filename="<?php echo $file["name"]; ?> "> <div class="loading"></div> <div class="data"> <span class="del text-center"><a class="link del">删除</a> </span> <span class="size" ><?php echo reunit($file["size"]); ?> </span> <span class="auto autocut" title="<?php echo $file["name"]; ?> "> <a target="_blank" href="<?php echo U('down?attach_id=' . f_encode($file['id'])); ?> "><?php echo $file["name"]; ?> </a> </span> </div> </li><?php
function showFile($add_file, $mode) { $files = explode(';', $add_file); if (count($files) > 1) { foreach ($files as $file) { if (strlen($file) > 1) { $fileId = f_decode($file); $fileId = $file; $model = M("File"); $File = $model->where("id={$fileId}")->field("name,size,extension")->find(); echo '<div class="attach_file" style="background-image:url(__PUBLIC__/images/ico/ico_' . strtolower($File['extension']) . '.jpg); background-repeat:no-repeat;"><a target="_blank" href="__URL__/down/attach_id/' . f_encode($file) . '">' . $File['name'] . ' (' . reunit($File['size']) . ')' . '</a>'; if ($mode == "edit") { echo '<a href="#" class="prgCancel" id="' . $file . '">删除</a>'; } echo '</div>'; } } } }