Salve...ho creato un form che da la possibilità di uppare files...
ed è il seguente:
<?
$EmailFrom = Trim(stripslashes($_POST['Email']));
$EmailTo = "[email protected]";
$Subject = "Music";
$Username = Trim(stripslashes($_POST['Username']));
$Titolo = Trim(stripslashes($_POST['Titolo']));
$Commento = Trim(stripslashes($_POST['Commento']));
$Filename = $_FILES ['File'] ['name'];
$Filetemp = $_FILES ['File'] ['tmp_name'];
if (is_uploaded_file($Filename)) {
if (move_uploaded_file($Filetemp, "Files/$Filename")) {
$Filelink = "http://www.mondonotte.net/Video/Files/".$Filename;
}}
// validation
$validationOK=true;
if (Trim($Username)=="") $validationOK=false;
if (Trim($Titolo)=="") $validationOK=false;
if (Trim($Email)=="") $validationOK=false;
if (Trim($Commento)=="") $validationOK=false;
if (file_exists ($Filelink)) {
$validationOK=true;
} else { $validationOK=false;
}
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mondonotte.net/Video/Errore/\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "User: ";
$Body .= $Username;
$Body .= "\n";
$Body .= "Titolo: ";
$Body .= $Titolo;
$Body .= "\n";
$Body .= "E-mail: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Commento: ";
$Body .= $Commento;
$Body .= "\n";
$Body .= "Link File: ";
$Body .= $Filelink;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mondonotte.net/Video/Ok/\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mondonotte.net/Video/Errore/\">";
}
?>
Facendo varie prove ho notato che a non funzionare sono i due if con i comandi "is_uploaded_file" e "move_uploaded_file"
tutto il resto funziona bene
qualcuno sa aiutarmi?
Grazie
ed è il seguente:
<?
$EmailFrom = Trim(stripslashes($_POST['Email']));
$EmailTo = "[email protected]";
$Subject = "Music";
$Username = Trim(stripslashes($_POST['Username']));
$Titolo = Trim(stripslashes($_POST['Titolo']));
$Commento = Trim(stripslashes($_POST['Commento']));
$Filename = $_FILES ['File'] ['name'];
$Filetemp = $_FILES ['File'] ['tmp_name'];
if (is_uploaded_file($Filename)) {
if (move_uploaded_file($Filetemp, "Files/$Filename")) {
$Filelink = "http://www.mondonotte.net/Video/Files/".$Filename;
}}
// validation
$validationOK=true;
if (Trim($Username)=="") $validationOK=false;
if (Trim($Titolo)=="") $validationOK=false;
if (Trim($Email)=="") $validationOK=false;
if (Trim($Commento)=="") $validationOK=false;
if (file_exists ($Filelink)) {
$validationOK=true;
} else { $validationOK=false;
}
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mondonotte.net/Video/Errore/\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "User: ";
$Body .= $Username;
$Body .= "\n";
$Body .= "Titolo: ";
$Body .= $Titolo;
$Body .= "\n";
$Body .= "E-mail: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Commento: ";
$Body .= $Commento;
$Body .= "\n";
$Body .= "Link File: ";
$Body .= $Filelink;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mondonotte.net/Video/Ok/\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mondonotte.net/Video/Errore/\">";
}
?>
Facendo varie prove ho notato che a non funzionare sono i due if con i comandi "is_uploaded_file" e "move_uploaded_file"
tutto il resto funziona bene
qualcuno sa aiutarmi?
Grazie