PeGaZe
22/12/2006, 10h32
Voici mon script PHP utilisé pour uploader des images dans un album :
if( isset($_POST['upload']) ) // si formulaire soumis
{
$content_dir = "../../album/photos/"; // dossier où sera déplacé le fichier
$tmp_file = $_FILES['fichier']['tmp_name'];
if( !is_uploaded_file($tmp_file) )
{
exit("Le fichier est introuvable");
}
// on vérifie maintenant l'extension
$type_file = $_FILES['fichier']['type'];
if( !strstr($type_file, 'jpg') && !strstr($type_file, 'jpeg') && !strstr($type_file, 'bmp') && !strstr($type_file, 'gif') && !strstr($type_file, 'png') )
{
exit("Le fichier n'est pas une image");
}
// on copie le fichier dans le dossier de destination
$name_file = $_FILES['fichier']['name'];
if(already_exist($name_file,$album_sel))
$name_file = 'M' . $name_file:
if( !move_uploaded_file($tmp_file, $content_dir . $name_file) )
{
exit("Impossible de copier le fichier dans $content_dir");
}
echo "Le fichier a bien été uploadé<br>";
}
Le problème est le suivant, j'ai à chaque fois cette page ensuite qui s'affiche quand j'essaye d'uploader une image :
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, tech@ovh.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/1.3.37 Server at www.bike55.be Port 80
Service non permis? Mauvais script de ma part? J'ai un 60GP.
Merci d'avance
if( isset($_POST['upload']) ) // si formulaire soumis
{
$content_dir = "../../album/photos/"; // dossier où sera déplacé le fichier
$tmp_file = $_FILES['fichier']['tmp_name'];
if( !is_uploaded_file($tmp_file) )
{
exit("Le fichier est introuvable");
}
// on vérifie maintenant l'extension
$type_file = $_FILES['fichier']['type'];
if( !strstr($type_file, 'jpg') && !strstr($type_file, 'jpeg') && !strstr($type_file, 'bmp') && !strstr($type_file, 'gif') && !strstr($type_file, 'png') )
{
exit("Le fichier n'est pas une image");
}
// on copie le fichier dans le dossier de destination
$name_file = $_FILES['fichier']['name'];
if(already_exist($name_file,$album_sel))
$name_file = 'M' . $name_file:
if( !move_uploaded_file($tmp_file, $content_dir . $name_file) )
{
exit("Impossible de copier le fichier dans $content_dir");
}
echo "Le fichier a bien été uploadé<br>";
}
Le problème est le suivant, j'ai à chaque fois cette page ensuite qui s'affiche quand j'essaye d'uploader une image :
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, tech@ovh.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/1.3.37 Server at www.bike55.be Port 80
Service non permis? Mauvais script de ma part? J'ai un 60GP.
Merci d'avance