Klokjis Posted March 22, 2006 Report Share Posted March 22, 2006 jautaajums - kaa var ar PHP paliidziibu izdzeest folderi ar failiem, rmdir() izdzeesh tukshu folderi, bet pilnam vinjsh izmet erroru ka folderis satur failus. vai probleema nav chmodos? ja folderim ir 755. bet parent_folderim tik un taa ir 777. (visiem pilniiga kontrole...)... Link to comment Share on other sites More sharing options...
Klez Posted March 22, 2006 Report Share Posted March 22, 2006 exec ('rm -rf ./') es izmantoju ito http://imo.popular.lv/testi/rmdirr.inc.php Link to comment Share on other sites More sharing options...
Klokjis Posted March 22, 2006 Author Report Share Posted March 22, 2006 neiebraucu ar ko tad tas rmdir atshkjiras?? nu man ir sekojoshi : $dir = '../sliktais_folderis/'; rmdirr ( $dir ); tad kas te buutu jaapamaina?? Link to comment Share on other sites More sharing options...
john.brown Posted March 22, 2006 Report Share Posted March 22, 2006 (edited) tev ir ne rmdirr($dir), bet rmdir($dir) :) Tas, ko Klez tev iedeva saitē, ir rekursīva funkcija, kura papriekš iztīra vajadzīgo folderi no visa, kas tanī iekšā, un tad aizvāc arī pašu folderi. Tur ar tā atšķirība... Ar vienu vārdu sakot, liec visu to kodu kaut kur savā skriptā, un tad izsauc rmdirr($dir), un viss notiks ;) Edited March 22, 2006 by john.brown Link to comment Share on other sites More sharing options...
Klokjis Posted March 22, 2006 Author Report Share Posted March 22, 2006 nu tnx. viss iet ;))) aa veel 1 jautaajums. ne gluzhi pa sho teemu. ir 5 shaadi lauki <input type="file" name"fails[]"> teoreetiski katram ir sava array veertiiba. a kaa ar if'u paarbaudiit vai visi 5 lauki nav tukshi? if(...) ?? Link to comment Share on other sites More sharing options...
john.brown Posted March 22, 2006 Report Share Posted March 22, 2006 Visticamāk, ka tikai taisot foreach() pa visiem laukiem. Link to comment Share on other sites More sharing options...
Klokjis Posted March 22, 2006 Author Report Share Posted March 22, 2006 nu ar foreach() vinjsh katru lauku var paarbaudiit un ja vinjsh ir tukshs tad izmest kaut kaadu pazinjojumu. a vajag taa, ka ja visi 5i ir tukshi, tikai tad lai izmet pazinjojumu. Link to comment Share on other sites More sharing options...
john.brown Posted March 22, 2006 Report Share Posted March 22, 2006 (edited) Vai tiešām pašam domāt slinkums! <?php $data = $_REQUEST['lauks']; $empty = 0; foreach($data as $lauks) { if(empty($lauks)) $empty++; } if($empty == count($data)) echo 'Visi tuksi!'; ?> Tavā gadījumā gan jāpārbauda $_FILES Edited March 22, 2006 by john.brown Link to comment Share on other sites More sharing options...
Klokjis Posted March 22, 2006 Author Report Share Posted March 22, 2006 (edited) hmm... tik un taa... edit: hmm... es nez. vinjsh tik un taa neizpilda if ($empty == count($data)) nosaciijumu. Edited March 22, 2006 by Klokjis Link to comment Share on other sites More sharing options...
Delfins Posted March 23, 2006 Report Share Posted March 23, 2006 otrādāk vajag.. ar FOR.. for ($i...) { $empty += ( empty($_FILES['files'][$i]) ) ? 1 : 0; } Link to comment Share on other sites More sharing options...
john.brown Posted March 23, 2006 Report Share Posted March 23, 2006 (edited) Man nez kāpēc viņš visu izpilda. <?php $data = $_FILES['fails']['name']; $empty = 0; foreach($data as $fname) { if(empty($fname)) $empty++; } if($empty == count($data)) echo 'Visi tuksi!'; ?> Edited March 23, 2006 by john.brown Link to comment Share on other sites More sharing options...
Recommended Posts