fxz Posted December 6, 2003 Report Share Posted December 6, 2003 vai kaads vareetu siikaak pastaastiit par $_FILES mainiigajiem - manuaali, cik skatiijos, ir aprakstiits visai truuciigi. Nu vismaz, skaidraaks man no taa nekas nekljuva ;) situaacija ir sekojosha (ljoti vienkaarsha ;) - upladeet failu: viss darbojas tiptop, ja upladeeshanu funkcijas atrodas vienaa failiaa, kur ir gan html, gan php - resp. apmeeram taa: [forma ar attieciigajiem input laukiem][php skripts failu upladeeshanai][veel nedaudz html][/b] Probleemas saakas tajaa briidii, kad es veelos izmantot templates, tb atshkjirt (vairaak vai mazaak) PHP no HTML daljas. PHP failos apstraadaaju visus datus, pieshkjiru mainiigajiem un tad to vērtības ievietoju attieciigajaas vietaas template failos. Viss ljoti jauki darbojas , bet tikko es gribu upladeet failu, masiivs $_FILES['userfile'] izraadaas tukshs. Ar $_REQUEST panjemt mainiigos no formas nav probleemas, bet $_FILES nestraadaa. Noteikti izklausaas diezgan murgaini, bet nu ceru, ka kaads vismaz sapratiis un varees paskaidrot. Esmu noseedeejis visu nakti pie shii un netieku skaidriibaa. Link to comment Share on other sites More sharing options...
hu_ha Posted December 6, 2003 Report Share Posted December 6, 2003 nu bez koda redzeeshanas laikam ka neko atbildeet nevar... Link to comment Share on other sites More sharing options...
fxz Posted December 6, 2003 Author Report Share Posted December 6, 2003 kods ir apmeeram shitaads - <? $content='<form enctype="multipart/form-data" method="POST" action="fileupload.php">'; $content.='<input type="file" name="image" />'; $content.='<input type="submit" name="add" value="Pievienot" /></form>'; if(isset($_REQUEST['add'])) { $d=""; // path if (copy($_FILES['image']['tmp_name'], $d.$_FILES['image']['name'])) { //success; } else { //failure; } } // Veertiibu ievietoshana template failaa $main_page = new template(); $main_page->assign( 'TOP', $top); $main_page->assign( 'MENU', $menu); $main_page->assign( 'CONTENT', $content); $main_page->display( 'html/page.tpl' ); //Izvada lapu ar atbilstoshajaam veertiibaam ?> Link to comment Share on other sites More sharing options...
Kaklz Posted December 6, 2003 Report Share Posted December 6, 2003 manuaali, cik skatiijos, ir aprakstiits visai truuciigi. nu par manuaalja truuciigumu atljaushos nepiekrist. Atrisinaajums tavai probleemai gan vareetu nebuut saistiits ar PHP, bet gan ar tieshi to tavu HTML dalju, jo kaa jau pats saki, tad $_FILES masiivs ir tukshss .. un ja jau vinsh ir tukshss, tad tas noziimee, ka dati netiek nosuutiiti.. Link to comment Share on other sites More sharing options...
hu_ha Posted December 6, 2003 Report Share Posted December 6, 2003 warning reports ir iesleegts? neuzraada kaut kaadas kljuudas vai warningus? tipa shitais likaas kaut kaa diivainaak: $content='<form enctype="multipart/form-data" method="POST" action="fileupload.php">';tur nevajag slashu pirms peedinjaam? tipa:$content='<form enctype=\"multipart/form-data\" method=\"POST\" action=\"fileupload.php\">'; tas taa uzmetot aci... nus cits nekas shajaa koda gabalaa nekriit aciis, taadat probleema ir citur... veel es nezinu vai funkcija copy darbojas taapat kaa move_uploded_file move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile) + visam - vari paarbaudiit vai tavaa failu masiivaa kaut kas tiek ielikts ar funkciju print_r: print_r($_FILES); Link to comment Share on other sites More sharing options...
fxz Posted December 7, 2003 Author Report Share Posted December 7, 2003 nea, cik man zinaams, ja stringu liek '', tad slashu pirms peedinjaam nevajag likt. Link to comment Share on other sites More sharing options...
Venom Posted December 8, 2003 Report Share Posted December 8, 2003 Vareetu buut vainiigs tas enctype="multipart/form-data", ja vinsh tev na pielikts, faili netiks uploadeeti Attieciibaa ja uuzo Operu - tur vinjai bija kaadi savi gljuki ja inputa nosaukumaa bija spacis, tad tas tika paart aisiit par _ (vai otraadi) Varbuut tev taas templaates $_FILES "paarnjem" savaa uzraduziibaa (shkiet, phpbb taa dariija ar $_SESSION variaabliem) Vai ir uzlikts input _type_=file un _name_? Vai ir nosleegts </form> tags? Vai submits naak no taas formas, kuraa ir uploads? Vai php.ini ir uzlikta uploadu temp direktorija? Vai pie taas ir rakstiishanas tiesiibas? Vai php.ini ir izdaliits upload_max_size (vai kaa vinsh tur bija)? error_reporting(E_ALL); print_r($_FILES); Link to comment Share on other sites More sharing options...
fxz Posted December 9, 2003 Author Report Share Posted December 9, 2003 jaa, tas viss man ir. lieta ir taada, sho dalju $content='<form enctype="multipart/form-data" method="POST" action="fileupload.php">'; $content.='<input type="file" name="image" />'; $content.='<input type="submit" name="add" value="Pievienot" /></form>'; if(isset($_REQUEST['add'])) { $d=""; // path if (copy($_FILES['image']['tmp_name'], $d.$_FILES['image']['name'])) { //success; } else { //failure; } } iekopeeju 1:1 citaa failaa un beigaas ierakstu echo $content - viss straadaa... anyway, forget it - mekleeshu citu risinaajumu, jo juutu, ka ar sho skaidriibaa netikshu. Link to comment Share on other sites More sharing options...
Recommended Posts