我很难让这个工作,我还没有想出一个工作场景。基本上,这是一个简单的用户友好的管理员,应该上传图像。但是,我无法让上传工作。文件名被添加到数据库中就好了,但图像不会上传。
这是代码:
function editMain($data){
array_pop($data);
$where = "main_id = {$data['main_id']}";
unset($data['main_id']);
//upload image
if ($_FILES['main_picture']['size'] > 1){ //if image deal with it
$data['main_picture'] = '/images/'.$_FILES['main_picture']['name'];
$uploadedfile = $_FILES['main_picture']['tmp_name'];
if (move_uploaded_file($uploadedfile, SITE_ROOT.$data['main_picture']))
echo "successfully uploaded {$data['main_picture']}<br />";
else
echo "failed to upload {$data['main_picture']}<br />";
}
感谢您的关注,并提前感谢您为我指明了正确的方向!