Je n'arrive pas à faire deux "fopen()" à la suite... Le premier marche bien mais le second m'envoie un Warning : "fopen(../depot/44R/in/) [function.fopen]: failed to open stream: Is a directory in /exec/applis/75mwas/G01R00C00/html/RCE/import_file.php on line 53"
Celà fait maintenant 3h que je cherche pourquoi et solliciter votre aide.
Ci dessous :
- le résultat du code
- suivi du code
Résultat du code ci-dessous :
split[0] ../depot/44R/in/ENT-ME-ORG_20140703.txt
split[1]100666 033261 025370 00000016557 12355335474 015332 0ustar00ad44mmirgp44rrce000000 000000 00087453|EN|20020131|CR|||010172|EBER07|20140703
ICI ca marche !
fc = null
split[0] ../depot/44R/in/ENT-REFERENCE-NEW_20140703.txt
split[1]100666 033261 025370 00000051347 12355335430 016315 0ustar00ad44mmirgp44rrce000000 000000 00001993|19930416|CR|||XXXXX|N|20140118|ACTI|302715966|VIVESCIA|||N|6317|G|4621Z|09|1927|41|700|2012|0|2|21|2
ICI ca marche PAS alors qu'on a bien un nom de fichier !
Warning: fopen(../depot/44R/in/) [function.fopen]: failed to open stream: Is a directory in /exec/applis/75mwas/G01R00C00/html/RCE/import_file.php on line 53
split[0] ../depot/44R/in/ETA-REFERENCE-NEW_20140703.txt
split[1]100666 033261 025370 00013020274 12355335472 016305 0ustar00ad44mmirgp44rrce000000 000000 00000007|14789095|20140703|CR|||20140703|ACTI|180090060|02829|N|SMA VERSAILLES-ARTOIS IGESA| 9||RUE|EDOUARD LEFEBVRE|78000|0910|VERSAILLES|XXXXX|11|78|646|INSTITUTION GESTION SOCIALE DES ARMEES|SMA VERSAILLES-ARTOIS IGESA|CASERNE D'ARTOIS|9 RUE EDOUARD LEFEBVRE||78000 VERSAILLES||Q|8891A|01|1|2014|1|062014|||P|0|
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 while (($file = readdir($dh)) !== false) { //echo $injection_path.$file."<br />".str_replace(".gz", "", $injection_path.$file)."<br />"; if($file != "." && $file != ".." && strtolower(substr($file,-4)) == ".tgz"){ $number_file++; //$fich[] = $file; $file = str_replace("f_44R75M1_", "", $file); //echo $injection_path.$file."<br />".str_replace(".gz", "", $injection_path.$file)."<br />"; $fz = gzopen($injection_path.$file, "r"); $fc = null; while (!gzeof($fz)) { $number++; $buffer = gzgets($fz, 4096); if(preg_match("#\.txt#", $buffer)) { if($fc != null) { echo "fc = null<br/>"; fclose($fc); unset($fc); $fc = null; } $vals=preg_split('#\.txt#',$buffer,-1,PREG_SPLIT_NO_EMPTY); $path = $injection_path.$vals[0].".txt"; echo "split[0] ".$path."<br />"; echo "split[1]".$vals[1]."<br /><br /><br />"; $fc = fopen($path, "a+"); fwrite($fc, $vals[1]); $fich[] = $path; } else { if($fc != null) { fwrite($fc, $buffer); } } } if($fc != null) { fclose($fc); } gzclose($fz); } }
Partager