https://static.06ms.com/static/images/index/21.jpg

发一个上传图片并返回地址到剪贴板的PHP代码

<?php
if($_POST['upload']=='OK'){
$uploaddir = './attachment/';
$fil_extend_ename = end(explode('.',basename($_FILES['userfile']['name'])));
$uploadfile = $uploaddir . date("YmdHis", time()) . floor(microtime()*1000).'.'.$fil_extend_ename;
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "<script type='text/javascript' >alert('上传成功!'); window.location.href='upload.php?id=$uploadfile';</script>";
} else {
echo "<script type='text/javascript'>alert('上传失败!');location.href='upload.php';</script>";