Na mojej cviňej stránke brod.borec.cz si neviem rady so súrorom "/source/0221.png". Súbor vznikol po uploadovaní z /gen/add.htm do /gen/add.php. /gen/add.php zavolal funkciu move_uploaded_file aby obrazok presunul na jeho miesto "/source/0221.png". Na stranke "/napalm.htm" sa tento obrazok neukazal. Po pouziti debuggeru som zistil ze server odpovedal:
HTTP/1.1 302 Found
Date: Wed, 28 Nov 2012 10:24:30 GMT
Server: Apache/2.0.59 (Unix)
Location: http://i.wz.cz/404.html
Content-Length: 288
Keep-Alive: timeout=4, max=49
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
To je jasne, subor neexistuje. No ked som to isiel skontrolovat cez ftp subor bol vo vypise "LIST -aL". Pokusil som sa ho vymazat "DELE /source/0221.png" a dostal som odpoved "550 DELE: Couldn't get file status for '/source/0221.png'.". Vo vypise stale je a neda sa prepisat!
Adresář /source/ neexistuje.
/ som použil ako koreň mojho domovskeho priecinka. V php pouzivam iba relativne sesty (../source/).
<HTML>Když na to kouknu sshčkem, tak tam vidím akorát soubor 0221.png?. Soubor 0221.png tam opravdu není.</HTML>
Aby som to celé zhodnotil: Vo výpise súborov cez ftp z adresára ~/source/ ho stále zobrazuje 0221.png ako súbor. Ale ak ho chcem vymazat alebo prepísat nefunguje to. Nemozem sa ho zbavit. Inak sa tvári akoby neexistoval. Subor "0221.png?" asi robí problém a nemá tam čo hladať!
Tak ten soubor "0221.png?" přejmenuj na "0221.png" a je to.
Uploadol som cez ftp správny subor a teraz mi vypisuje DVA s ROVNAKÝM MENOM. Cez ftp nemozem odstranit ten druhý. Otaznik na konci mena je chyba a ftp ho nepodporuje. Ten subor ma asi 200kb takze mi tam velmi nezavadzia. Mozem sa ho pokusit vymazat cez php ulink() ked sa to neda cez ftp. Cele stranky mam zalohovane doma. "~/source/0221.png?" je chybný, nemá tam co hladať a nejde vymazat ani premenovat.
Zrovna jsem si vytvořil soubor s otazníkem na konci názvu, nahrál přes FTP na svůj web a zase ho přes FTP smazal. Vše naprosto bez potíží. Něco asi děláš špatně. Jakého používáš FTP klienta?
Ako klient pouzivam gFTP graficke ale ako nastal tento problem skusil som vas webftp a nakoniec aj program ftp z debianu. Tu je vypis:
tomas@tomas:~$ ftp brod.borec.cz
Connected to brod.borec.cz.
220 ftp server ready
Name (brod.borec.cz:tomas): brod.borec.cz
331 Password required for brod.borec.cz.
Password:
230-Last login on 2012-12-01 18:01:44 from 95.102.110.50.
Quotas: using 2912.00 of 204800 KB (1.42% used)
230 Access granted for brod.borec.cz.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls /source/
200 PORT command successful
150 Opening ASCII mode data connection for file list
drwxr-xr-x 2 user group 3224 Nov 28 14:21 .
drwxrwxr-x 6 user group 600 Nov 27 17:32 ..
-rw-r--r-- 1 user group 259 Nov 4 19:09 0010.txt
-rw-r--r-- 1 user group 81 Nov 4 19:09 0020.txt
-rw-r--r-- 1 user group 606 Nov 4 19:13 0030.txt
-rw-r--r-- 1 user group 415 Nov 4 19:13 0040.txt
-rw-r--r-- 1 user group 76 Nov 4 19:11 0050.txt
-rw-r--r-- 1 user group 328 Nov 4 19:11 0060.txt
-rw-r--r-- 1 user group 597 Nov 4 19:13 0070.txt
-rw-r--r-- 1 user group 567 Nov 4 19:09 0080.txt
-rw-r--r-- 1 user group 396 Nov 4 19:11 0090.txt
-rw-r--r-- 1 user group 389 Nov 4 19:11 0100.txt
-rw-rw-r-- 1 user group 89201 Nov 4 19:13 0101.png
-rw-r--r-- 1 user group 16 Nov 4 19:13 0101.txt
-rw-r--r-- 1 user group 380 Nov 4 19:09 0110.txt
-rw-rw-r-- 1 user group 114693 Nov 4 19:13 0111.png
-rw-r--r-- 1 user group 16 Nov 4 19:13 0111.txt
-rw-r--r-- 1 user group 607 Nov 4 19:11 0120.txt
-rw-r--r-- 1 user group 788 Nov 4 19:11 0130.txt
-rw-r--r-- 1 user group 723 Nov 4 19:09 0140.txt
-rw-rw-r-- 1 user group 117239 Nov 4 19:13 014_1.png
-rw-r--r-- 1 user group 107 Nov 4 19:09 0150.txt
-rw-rw-r-- 1 user group 57211 Nov 4 19:11 015_1.png
-rw-rw-r-- 1 user group 62983 Nov 4 19:13 015_2.png
-rw-r--r-- 1 user group 125 Nov 4 19:09 0160.txt
-rw-r--r-- 1 user group 485 Nov 4 19:09 0170.txt
-rw-r--r-- 1 user group 16 Nov 4 19:13 0171.txt
-rw-r--r-- 1 user group 312 Nov 4 19:11 0180.txt
-rw-r--r-- 1 user group 16 Nov 4 19:13 0181.txt
-rw-r--r-- 1 user group 82 Nov 4 19:09 0190.txt
-rw-r--r-- 1 user group 16 Nov 4 19:11 0191.txt
-rw-r--r-- 1 user group 217 Nov 4 19:11 0200.txt
-rw-r--r-- 1 user group 152 Nov 4 19:09 0210.txt
-rw-rw-r-- 1 user group 46082 Nov 4 19:09 021_2.png
-rw-r--r-- 1 user group 219 Nov 4 19:13 0220.txt
-rw-rw-r-- 1 user group 133852 Nov 28 14:21 0221.png
-rw-r--r-- 1 user group 133852 Nov 27 19:41 0221.png
-rw-r--r-- 1 user group 94 Nov 27 19:43 0221.txt
-rw-r--r-- 1 user group 492 Nov 4 19:13 0230.txt
-rw-r--r-- 1 user group 94 Nov 4 19:13 0240.txt
-rw-rw-r-- 1 user group 93825 Nov 4 19:13 0241.png
-rw-r--r-- 1 user group 29 Nov 4 19:13 0241.txt
-rw-r--r-- 1 user group 1176 Nov 4 19:11 0250.txt
-rw-rw-r-- 1 user group 59153 Nov 4 19:11 0251.png
-rw-r--r-- 1 user group 29 Nov 4 19:09 0251.txt
-rw-r--r-- 1 user group 234 Nov 4 19:13 0260.txt
-rw-rw-r-- 1 user group 124161 Nov 4 19:13 0261.png
-rw-r--r-- 1 user group 28 Nov 4 19:09 0261.txt
-rw-r--r-- 1 user group 83 Nov 4 19:11 0270.txt
-rw-rw-r-- 1 user group 85033 Nov 4 19:09 0271.png
-rw-r--r-- 1 user group 30 Nov 4 19:13 0271.txt
-rw-rw-r-- 1 user group 51384 Nov 4 19:09 027_1.png
-rw-r--r-- 1 user group 180 Nov 4 19:09 0280.txt
-rw-rw-r-- 1 user group 47370 Nov 4 19:13 0281.png
-rw-r--r-- 1 user group 31 Nov 4 19:11 0281.txt
-rw-r--r-- 1 user group 102 Nov 4 19:13 0290.txt
-rw-r--r-- 1 user group 65 Nov 4 19:09 0300.txt
-rw-r--r-- 1 user group 381 Nov 4 19:13 0310.txt
-rw-rw-r-- 1 user group 102111 Nov 4 19:09 0311.png
-rw-r--r-- 1 user group 23 Nov 4 19:11 0311.txt
-rw-r--r-- 1 user group 243 Nov 4 19:11 0320.txt
-rw-r--r-- 1 user group 240 Nov 4 19:09 0330.txt
-rw-r--r-- 1 user group 121 Nov 4 19:13 0340.txt
-rw-r--r-- 1 user group 109 Nov 4 19:11 0350.txt
-rw-r--r-- 1 user group 366 Nov 4 19:11 0360.txt
-rw-r--r-- 1 user group 244 Nov 4 19:11 0370.txt
-rw-r--r-- 1 user group 383 Nov 4 19:13 0380.txt
-rw-r--r-- 1 user group 236 Nov 4 19:13 0390.txt
-rw-r--r-- 1 user group 108 Nov 4 19:13 0400.txt
-rw-r--r-- 1 user group 64 Nov 4 19:13 0410.txt
-rw-r--r-- 1 user group 120 Nov 4 19:09 0420.txt
-rw-r--r-- 1 user group 148 Nov 4 19:09 0430.txt
-rw-rw-r-- 1 user group 86825 Nov 4 19:11 043_1.png
-rw-r--r-- 1 user group 215 Nov 4 19:09 0440.txt
-rw-rw-r-- 1 user group 80233 Nov 4 19:13 0441.png
-rw-r--r-- 1 user group 16 Nov 4 19:09 0441.txt
-rw-r--r-- 1 user group 176 Nov 4 19:13 0450.txt
-rw-r--r-- 1 user group 136 Nov 4 19:13 0460.txt
-rw-r--r-- 1 user group 172 Nov 4 19:13 0470.txt
-rw-r--r-- 1 user group 76 Nov 4 19:09 0480.txt
-rw-r--r-- 1 user group 215 Nov 4 19:13 0490.txt
-rw-r--r-- 1 user group 174 Nov 4 19:11 0500.txt
-rw-r--r-- 1 user group 624 Nov 4 19:09 0510.txt
-rw-r--r-- 1 user group 443 Nov 4 19:13 0520.txt
-rw-r--r-- 1 user group 175 Nov 4 19:09 0530.txt
-rw-r--r-- 1 user group 16 Nov 4 19:13 0531.txt
-rw-r--r-- 1 user group 165 Nov 4 19:11 0540.txt
-rw-r--r-- 1 user group 371 Nov 4 19:11 0550.txt
-rw-r--r-- 1 user group 16 Nov 4 19:13 0551.txt
-rw-r--r-- 1 user group 136 Nov 4 19:09 0560.txt
-rw-r--r-- 1 user group 328 Nov 4 19:13 0570.txt
-rw-r--r-- 1 user group 122 Nov 4 19:09 0580.txt
-rw-r--r-- 1 user group 215 Nov 4 19:11 0590.txt
-rw-r--r-- 1 user group 41 Nov 4 19:13 0591.txt
-rw-r--r-- 1 user group 318 Nov 4 19:09 0600.txt
-rw-r--r-- 1 user group 41 Nov 4 19:13 0601.txt
-rw-r--r-- 1 user group 67 Nov 4 19:11 0610.txt
-rw-r--r-- 1 user group 204 Nov 4 19:09 0620.txt
-rw-rw-r-- 1 user group 153752 Nov 4 19:09 0621.png
-rw-r--r-- 1 user group 25 Nov 4 19:13 0621.txt
-rw-r--r-- 1 user group 54 Nov 4 19:09 0630.txt
-rw-r--r-- 1 user group 64 Nov 4 19:09 0640.txt
-rw-r--r-- 1 user group 94 Nov 4 19:13 0650.txt
-rw-r--r-- 1 user group 114 Nov 4 19:11 0660.txt
-rw-r--r-- 1 user group 96 Nov 4 19:13 0670.txt
-rw-r--r-- 1 user group 182 Nov 4 19:09 0680.txt
-rw-r--r-- 1 user group 135 Nov 4 19:13 0690.txt
-rw-r--r-- 1 user group 152 Nov 4 19:09 0700.txt
-rw-r--r-- 1 user group 340 Nov 21 17:12 0710.txt
-rw-r--r-- 1 user group 175 Nov 4 19:09 0720.txt
-rw-r--r-- 1 user group 153 Nov 4 21:01 0730.txt
-rw-rw-r-- 1 user group 211 Nov 27 18:30 0740.txt
-rw-r--r-- 1 user group 198 Nov 10 15:44 0750.txt
-rw-r--r-- 1 user group 145 Nov 10 15:50 0760.txt
-rw-r--r-- 1 user group 157 Nov 27 16:53 0770.txt
-rw-r--r-- 1 user group 273 Nov 27 19:30 0780.txt
-rw-r--r-- 1 user group 261 Nov 27 19:26 0790.txt
-rw-r--r-- 1 user group 261 Nov 27 19:23 0800.txt
-rw-r--r-- 1 user group 104 Nov 28 09:53 0810.txt
-rw-rw-rw- 1 user group 275 Nov 28 09:56 0820.txt
-rw-rw-r-- 1 user group 124559 Nov 28 10:33 0821.png
-rw-rw-rw- 1 user group 30 Nov 28 09:57 0821.txt
-rw-rw-rw- 1 user group 32 Nov 28 09:57 0822.txt
-rw-rw-rw- 1 user group 161 Nov 28 10:34 0830.txt
-rw-rw-r-- 1 user group 107700 Nov 28 10:30 0831.png
-rw-r--r-- 1 user group 31 Nov 28 10:01 0831.txt
-rw-rw-r-- 1 user group 178664 Nov 28 10:30 0832.png
-rw-r--r-- 1 user group 24 Nov 28 10:01 0832.txt
-rw-r--r-- 1 user group 130 Nov 28 10:05 0840.txt
-rw-rw-r-- 1 user group 174559 Nov 28 10:31 0841.png
-rw-r--r-- 1 user group 29 Nov 28 10:03 0841.txt
-rw-r--r-- 1 user group 175 Nov 28 14:18 0850.txt
226-Transfer complete.
226 Quotas: using 2912.00 of 204800 KB (1.42% used)
ftp> quit
221 Goodbye.
Nejspíš na konci není otazník, ale nějaký neviditelný znak. Pokud v tom FTP na Debianu zadáš příkaz
mdel 0221.png*
smažou se všechny soubory začínající na "0221.png", tedy i soubor s vadným znakem.
Ano, bol to neviditelny znak asi medzera alebo LF. Prikaz do ftp mdel 0221.png* vyhlasil ze taky subor neexistuje. Ale uz som to vyriesil pomocov nasledujuceho skriptu:
<?php
unlink("0221.png?");
$ha=opendir("./");
while($n=readdir($ha)){
echo "{".$n."}<br>\n";
if(substr($n,0,8)=="0221.png"){
echo "je carovny<br>\n";
unlink($n);
}
}
closedir($ha);
?>
Dakujem za pomoc, bol to velmi zapeklity problem.