par
phpdog » 05 déc. 2005, 15:54
Sa se complique :
Maintenant je suis entrain de créer un formulaire qui permet de sélectionner un fichier à traiter, voici le formulaire :
<form method="POST" action="SupprLatin.php" enctype="multipart/form-data">
<!-- champs d'envoi de fichier, de type file -->
<p><label for="SupprLatin">Aller chercher le fichier: </label><input type="file" name="SupprLatin" /></p>
<p><input type="submit" name="envoi" value="Traiter le fichier" /></p>
</form>
Et voici le script php :
<?php
if(!isset($_POST['SupprLatin']) || empty($_POST['SupprLatin'])){
print("<center>Aucun fichier n'a été selectionner !</center>");
echo "<script type='text/javascript'>window.location.replace(‘index.php');</script>"; // Redirection vers l'index
} else {
$LatinSuppr = $_POST['SupprLatin'];
$texte=file_get_contents($LatinSuppr);
$texte=str_replace(ASupprimer,'',$texte);
$fp = fopen ($LatinSuppr, "w+");
fputs ($fp, $texte);
fclose ($fp);
echo "<script type='text/javascript'>window.location.replace(‘index.php');</script>";
}
?>
Mais hélas se ne fonctionne pas, quelqu’un pourrait-il m’aider à trouver le bug ?
Il n’y a pas de message d’erreur.
[u]Sa se complique :[/u]
Maintenant je suis entrain de créer un formulaire qui permet de sélectionner un fichier à traiter, voici le formulaire :
[php]<form method="POST" action="SupprLatin.php" enctype="multipart/form-data">
<!-- champs d'envoi de fichier, de type file -->
<p><label for="SupprLatin">Aller chercher le fichier: </label><input type="file" name="SupprLatin" /></p>
<p><input type="submit" name="envoi" value="Traiter le fichier" /></p>
</form>[/php]
Et voici le script php :
[php]<?php
if(!isset($_POST['SupprLatin']) || empty($_POST['SupprLatin'])){
print("<center>Aucun fichier n'a été selectionner !</center>");
echo "<script type='text/javascript'>window.location.replace(‘index.php');</script>"; // Redirection vers l'index
} else {
$LatinSuppr = $_POST['SupprLatin'];
$texte=file_get_contents($LatinSuppr);
$texte=str_replace(ASupprimer,'',$texte);
$fp = fopen ($LatinSuppr, "w+");
fputs ($fp, $texte);
fclose ($fp);
echo "<script type='text/javascript'>window.location.replace(‘index.php');</script>";
}
?>[/php]
Mais hélas se ne fonctionne pas, quelqu’un pourrait-il m’aider à trouver le bug ?
Il n’y a pas de message d’erreur.