fichier .xml via ftp mais file_put_contents le tronque
Bonjour à tous :P
j'ai un souci avec l'envoi d'un fichier via ftp. Je m'explique:
j'envoie au serveur le contenu d'un fichier xml (créé à la volé dynamiquement).
ce fichier xml (commande.xml) doit être placé sur un autre serveur via ftp.
ce contenu arrive bien formé et complet.
mais parfois (assez souvent d'ailleurs) je me retrouve avec un fichier commande.xml TRONQUE
je trace ce contenu dans une table de trace afin de bien verifier que les données arrivent bien et c'est TOUJOURS le cas.
Quelqu'un pourrait avoir une idée de pourquoi mon file_put_contents n'arrive pas au bout de l'écriture du fichier?
Notes:
1 : le contenu xml est créé avec as3 via new XML(chaine).
2 : je fais le même type de procédure mais avec des données arrivées dans un bytearray et compressé (aussi créé par as3), un contenu beaucoup plus gros et pourtant je n'ai jamais ce souci.
je commence à déséspérer grave avec ça car il s'agit d'un fichier de quelques Ko seulement!
Voici mon code et puis plus bas je vais voir si je peux coller le xml (celui qui se trouve dans la table des traces):
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
//create a stream context telling PHP to overwrite the file
$stream_options = array('ftp' => array('overwrite' => true));
$stream_context = stream_context_create($stream_options);
mb_internal_encoding("UTF-8");
$destination_file1 = $adr_client.'/commande.xml';
$hostname1 = 'ftp://' . $this->ftp_user_name . ":" . $this->ftp_user_pass . "@" . $this->ftp_server . '/' . $destination_file1;
$sql = "INSERT INTO `trace` (`id` ,`t1` ,`t2` ) VALUES (NULL , 'dans envoyerXMLLivre - $destination_file1', '$commande')";
mysql_query($sql);
//$upload = file_put_contents($hostname1, $commande, 0, $stream_context);
if (file_put_contents($hostname1, $commande, 0, $stream_context)) {ftp_close($conn_id); return true; }
else {ftp_close($conn_id); return false; } |
Code:
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
<FujiFilm>
<General>
<VersionXDI>2.4.5</VersionXDI>
</General>
<Commande>
<NumeroClientInitial>17669</NumeroClientInitial>
<CodeLangueInitiale>1</CodeLangueInitiale>
<DatePriseCommandeConsommateur>11/01/2011 23:11:29</DatePriseCommandeConsommateur>
<NomPriseCommande>tartampion, pierre</NomPriseCommande>
<ReferenceCommandeConsommateur>C0-878PN2259</ReferenceCommandeConsommateur>
<ReferenceMachineEmettrice>Photo Web</ReferenceMachineEmettrice>
<TypeExpeditionInitial>1</TypeExpeditionInitial>
<AdresseExpedition1>62 avenue de tartempion</AdresseExpedition1>
<AdresseExpedition2/>
<AdresseFacturation1>62 avenue de tartempion</AdresseFacturation1>
<AdresseFacturation2/>
<CodeGammeAffranchissement>1</CodeGammeAffranchissement>
<CodePostalExpedition>75000</CodePostalExpedition>
<CodePostalFacturation>75000</CodePostalFacturation>
<EmailConsommateur>tartampion@hotmail.com</EmailConsommateur>
<EmailExpedition>tartampion@hotmail.com</EmailExpedition>
<EmailFacturation>tartampion@hotmail.com</EmailFacturation>
<NomExpedition>Edouard tartampion</NomExpedition>
<NomFacturation>Edouard tartampion</NomFacturation>
<NomFichierFacture>Facture.pdf</NomFichierFacture>
<PaysExpeditionInitial>FRA</PaysExpeditionInitial>
<PaysFacturationInitial>FRA</PaysFacturationInitial>
<VilleExpedition>Paris</VilleExpedition>
<VilleFacturation>Paris</VilleFacturation>
<Ordre>
<CodeArticleInitial>8958</CodeArticleInitial>
<NombreFichiers>26</NombreFichiers>
<GroupeFichiers>
<NumeroGroupeInitial>1</NumeroGroupeInitial>
<NombreExemplaires>1</NombreExemplaires>
<TotalPagesAlbum>26</TotalPagesAlbum>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.2.jpg</NomFichier>
<NomFichierInitial>snapshot.2.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.3.jpg</NomFichier>
<NomFichierInitial>snapshot.3.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.4.jpg</NomFichier>
<NomFichierInitial>snapshot.4.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.5.jpg</NomFichier>
<NomFichierInitial>snapshot.5.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.6.jpg</NomFichier>
<NomFichierInitial>snapshot.6.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.7.jpg</NomFichier>
<NomFichierInitial>snapshot.7.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.8.jpg</NomFichier>
<NomFichierInitial>snapshot.8.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.9.jpg</NomFichier>
<NomFichierInitial>snapshot.9.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.10.jpg</NomFichier>
<NomFichierInitial>snapshot.10.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.11.jpg</NomFichier>
<NomFichierInitial>snapshot.11.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.12.jpg</NomFichier>
<NomFichierInitial>snapshot.12.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.13.jpg</NomFichier>
<NomFichierInitial>snapshot.13.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.14.jpg</NomFichier>
<NomFichierInitial>snapshot.14.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.15.jpg</NomFichier>
<NomFichierInitial>snapshot.15.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.16.jpg</NomFichier>
<NomFichierInitial>snapshot.16.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.17.jpg</NomFichier>
<NomFichierInitial>snapshot.17.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.18.jpg</NomFichier>
<NomFichierInitial>snapshot.18.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.19.jpg</NomFichier>
<NomFichierInitial>snapshot.19.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.20.jpg</NomFichier>
<NomFichierInitial>snapshot.20.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.21.jpg</NomFichier>
<NomFichierInitial>snapshot.21.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.22.jpg</NomFichier>
<NomFichierInitial>snapshot.22.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.23.jpg</NomFichier>
<NomFichierInitial>snapshot.23.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.24.jpg</NomFichier>
<NomFichierInitial>snapshot.24.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.25.jpg</NomFichier>
<NomFichierInitial>snapshot.25.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.26.jpg</NomFichier>
<NomFichierInitial>snapshot.26.jpg</NomFichierInitial>
</Fichier>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.27.jpg</NomFichier>
<NomFichierInitial>snapshot.27.jpg</NomFichierInitial>
</Fichier>
</GroupeFichiers>
</Ordre>
<Ordre>
<CodeArticleInitial>8515</CodeArticleInitial>
<NombreFichiers>1</NombreFichiers>
<TotalEpreuvesDemandees>1</TotalEpreuvesDemandees>
<GroupeFichiers>
<NumeroGroupeInitial>1</NumeroGroupeInitial>
<NombreExemplaires>1</NombreExemplaires>
<TotalPagesAlbum>26</TotalPagesAlbum>
<Fichier>
<IndicateurCorrectionInitial>False</IndicateurCorrectionInitial>
<NombreExemplaires>1</NombreExemplaires>
<NomFichier>snapshot.72.jpg</NomFichier>
<NomFichierInitial>snapshot.72.jpg</NomFichierInitial>
</Fichier>
</GroupeFichiers>
</Ordre>
</Commande>
</FujiFilm> |
Si quelqu'un peut avoir une lumière sur ce qui peut arriver à mon code ou à ftp ou à xml pour ne pas terminer le fichier?
merci beaucoup à tous, votre aide peut être précieuse!!! car je cherche depuis des heures!!!!!