这是上传表单
Filename:
这是php:
$keys = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
for ($i = 0; $i < 10; $i++) {
$photoID .= $keys[rand(0, strlen($keys)-1)];
}
//add a dot (.) to the randomly generated string so the ext can be applied to it later
$photoID2 = $photoID.".jpg";
//This assigns the subdirectory you want to save into... make sure it exists!
$target = "uploads/";
//This combines the directory, the random file name, and the extension
$target = $target . $photoID2.$ext;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
echo "The file has been uploaded as ".$photoID2.$ext;
} else {
echo "Error: upload did not work";
}
?>
我遇到的问题是我不断上传错误上传不起作用......我在这里做错了什么?这是我缺少的基本内容,但我需要了解它,因为我已经可以完成文件上传,但想了解它是如何工作的......