我试图制作Drag&删除图像上传工作及其工作:-D
服务器端处理由PHP Upload Class
完成HTML FORM:
<?php
error_reporting(E_ALL);
include('includes/class.upload.php');
// set variables
$dir_dest = (isset($_GET['dir']) ? $_GET['dir'] : '../pics/');
$dir_thumb = (isset($_GET['dir']) ? $_GET['dir'] : '../pics/thumbs/');
$dir_pics = (isset($_GET['pics']) ? $_GET['pics'] : $dir_dest);
// ---------- SIMPLE UPLOAD ----------
$handle = new Upload($_FILES['file']);
$thumb = new Upload($_FILES['file']);
if ($handle->uploaded) {
$handle->Process($dir_dest);
$thumb->Process($dir_thumb);
// we check if everything went OK
if ($handle->processed) {
// everything was fine !
echo 'Success';
} else {
// one error occured
echo 'error';
}
// we delete the temporary files
$handle-> Clean();
} else {
// if we're here, the upload file failed for some reasons
// i.e. the server didn't receive the file
echo '<p class="result">';
echo ' <b>File not uploaded on the server</b><br />';
echo ' Error: ' . $handle->error . '';
echo '</p>';
}
if (isset($handle)) {
echo '<pre>';
echo($handle->log);
echo '</pre>';
}
?>
PHP代码:
<input name="field" type="radio" />
图像已成功上传到相应的目录中。
我需要做的是存储图像信息,例如:图像标题,图像源,许可证,时间戳等等。因此,当用户放置图像时,应该有一个提示表单或输入字段。在填写所需输入后,信息应与图像上传一起提交到数据库中。
就是这样:))