0
Well, basically I’m trying to upload an mp3 file to a folder I created from the server, but I’ve done everything, and I always end up with the same mistake. That is the code:
<?php
include("connectsql.php");
isset($_GET ['mp3file']) ? $_GET['mp3file'] : '';
$songname = $_GET['songname'];
$query = "SELECT id FROM songs WHERE Song = '$songname'";
$result = mysqli_query($link, $query) or die(mysqli_error($link));
$uploaddir = 'http://localhost/sitededownload/musicas/';
$uploadfile = $uploaddir . basename($_FILES['mp3file']["name"]);
if($result){
$nomemusica = mysqli_fetch_assoc($result);
}
echo "<pre>";
if (move_uploaded_file($_FILES['mp3file']["name"], $uploadfile)) {
echo "Arquivo válido e enviado com sucesso.\n";
}else {
echo "Possível ataque de upload de arquivo!\n";
}
PRINT_R($_FILES);
echo "</pre>";
?>
and this is the result of PRINT_R:
Possível ataque de upload de arquivo!
Array
(
[mp3file] => Array
(
[name] => I Feel It Coming.mp3
[type] =>
[tmp_name] =>
[error] => 1
[size] => 0
)
)
some solution?
Is that line right?
$uploaddir = 'http://localhost/sitededownload/musicas/';
&#I thought it had to be something like this:$uploaddir = 'sitededownload/musicas/
– RpgBoss
@Rpgboss well noted, this is another error, note that the error value occurs before move_upload, as this function only moves from the server’s TMP folder to the desired folder, actually the upload already occurs and has failed before. + 1 pro your comment.
– Guilherme Nascimento
thanks for the answers guys, I will do all this and I come back here to tell the result, I thank from now!!
– Fernando Aguiar Pinedo