0

基本的に、私はこのガイドに従っていますが、これは非常に簡単ですが、今は完全に迷っています。最初からやり直す必要はありません。ほんのわずかな調整であることを願っていますが、エラーは次のとおりです。

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."; 
    } 
    ?> 

おそらく、すべてが画面上で落書きのように感じられるようになったので、正しい方向への一歩は非常に高く評価されますが、最初からやり直すのは嫌です.

4

2 に答える 2

1

試す

 $targetp = "/thumbnails/;

 $targets = "/audio/";

または c:/some/path/here のようにフルパス名を指定します

于 2012-10-20T17:16:55.243 に答える
1

してみてください

変化する

basename( $_FILES['cover']['artist']);

basename( $_FILES['cover']['name']);
于 2012-10-20T17:14:46.033 に答える