merci par avance pour votre aide !!
je bloque sur un problème dont je suis sur que la réponse est simple mais....
Dans ma page index.php, je charge un fichier via un formulaire
je lis les informations sur la page suivante (lecture.php)
et en fonction d'une de ces informations je dois relire séquentiellement ce même fichier avec la méthode adaptée.
J'aimerai ne pas a avoir uploader le même fichier une deuxième fois sur la page lecture.php (via un formulaire) mais passer directement le fichier en paramètre mais je n'y arrive pas
(En gros, je souhaiterais avoir a uploader le fichier, ensuite affichage des informations du fichier, puis ensuite générer un pdf en cliquant sur un bouton "générer le pdf" sans avoir a uploader le meme fichier de nouveau)
index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gestion des editions</title>
<link href="config/format.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="700" align="center" border="0">
<tr>
<td class="FondBleu">
<?php include('top.php');?>
</td>
</tr>
<tr><td align="center">Version 1.00 - Mise à jour le 01 Aout 2012</td></tr>
<tr>
<td class="FondBleu" align="center">
<form enctype="multipart/form-data" action="lecture.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="50000000" />
Fichier à intégrer <br>
<input type="file" name="monfichier" /><br><br>
<input type="submit" value="Envoyer" />
</form>
</td>
</tr>
</table>
</body>
</html>
lecture.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gestion des editions</title>
<link href="config/format.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
// ne pas tenir compte des erreurs Notice
error_reporting(E_ALL ^ E_NOTICE);
//RECUPERATION DU FICHIER et copie de travail
$nomoriginal= $_FILES["monfichier"]["name"];
$nomfichier = $_FILES["monfichier"]["tmp_name"]; //copie
// lecture de la dernière ligne du fichier
$tab = file($nomfichier);
$last_ligne = $tab[count($tab)-1];
$montant_total = substr($last_ligne, 10, 14);
$nb_total = substr($last_ligne, 24, 6);
$nb_lignes_fichier = substr($last_ligne, 4, 6);
$code_type = substr($last_ligne, 0, 2);
if ($code_type=="AC")
{$methode = "generer_pdf_AC.php";}
elseif ($code_type == "MC")
{$methode = "generer_pdf_MC.php";}
else
{$methode = "generer_pdfC.php";}
?>
<table width="700" align="center" border="0">
<tr>
<td class="FondBleu">
<?php include('top.php');?>
</td>
</tr>
<tr><td align="center">Informations</td></tr>
<tr>
<td class="FondBleu">
<?php
echo 'type courrier : '.$code_type.'<br>';
echo 'nom fichier : '.$nomoriginal.'<br>';
echo 'nom fichier temporaire : '.$nomfichier.'<br>';
echo 'montant total : '.$montant_total.'<br>';
echo 'nombre total : '.$nb_total.'<br>';
echo 'nombre total lignes : '.$nb_lignes_fichier.'<br>';
echo 'Methode : '.$methode.'<br>';
?>
</td>
</tr>
<tr>
<td class="FondBleu" align="center">
<form enctype="multipart/form-data" action="<?php echo $methode; ?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="50000000" />
<input type="file" name="monfichier" value="<?php echo $nomoriginal ?>" /><br><br>
<input type="submit" value="Générer le PDF" />
</form>
</td>
</tr>
</table>
</body>
</html>
Si quelqu'un avait une solution, ce serait vraiment parfait !!!Merci mille fois par avance
Théo