好的,基本上我正在遵循这个非常简单的指南,但是,我现在完全迷失了方向。我不想重新开始,我希望这只是一个小的调整,但无论如何这里是错误:
Warning: move_uploaded_file() [function.move-uploaded-file]: The second argument to copy() function cannot be a directory in /I don't want to publicize the path name/html/add.php on line 39
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpqd62Gk' to 'thumbnails/' in /I don't want to publicize the path name/add.php on line 39
Sorry, there was a problem uploading your cover. Please check it is the appropriate size and format.
Warning: move_uploaded_file() [function.move-uploaded-file]: The second argument to copy() function cannot be a directory in /I don't want to publicize the path name/add.php on line 52
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpFVlGsv' to 'audio/' in /I don't want to publicize the path name/add.php on line 52
Sorry, there was a problem uploading your song. Please check it is the appropriate size and format.
这是提交表单后执行的“add.php”:
<?php
include "db_config.php";
//This is the directory where images will be saved
$targetp = "thumbnails/";
$targetp = $targetp . basename( $_FILES['cover']['artist']);
//This is our size condition
if ($uploaded_size > 100000)
{
echo "Your file is too large.<br>";
$ok=0;
}
//This is the directory where songs will be saved
$targets = "audio/";
$targets = $targets . basename( $_FILES['song']['artist']);
//This is our size condition
if ($uploaded_size > 6000000)
{
echo "Your file is too large.<br>";
$ok=0;
}
//This gets all the other information from the form
$title=$_POST['title'];
$artist=$_POST['artist'];
$cover=($_FILES['cover']['artist']);
$song=($_FILES['song']['artist']);
$today = date("Ymd");
$ip = $_SERVER['REMOTE_ADDR'];
//Writes the information to the database
mysql_query("INSERT INTO `Thumbnails` VALUES ( '', '$artist - $title', '$cover', '', '$song', '$title', '$artist', '$today', '$ip')") ;
//Writes the photo to the server
if(move_uploaded_file($_FILES['cover']['tmp_name'], $targetp))
{
//Tells you if its all ok
echo "The file ". basename( $_FILES['cover']['artist']). " has been uploaded, and your information has been added to the directory";
}
else {
//Gives and error if its not
echo "Sorry, there was a problem uploading your cover. Please check it is the appropriate size and format.";
}
//Duplicate for song
if(move_uploaded_file($_FILES['song']['tmp_name'], $targets))
{
echo "The file ". basename( $_FILES['song']['artist']). " has been uploaded, and your information has been added to the directory";
}
else {
echo "Sorry, there was a problem uploading your song. Please check it is the appropriate size and format.";
}
?>
也许朝着正确方向迈出的一步将不胜感激,因为它已经到了在屏幕上乱涂乱画的地步,但我不想重新开始。