blondine Posted May 23, 2010 Report Share Posted May 23, 2010 izrkanjaajos pa php un google.. un neko jedzigu neatradu , lai gan pilns nets ar drazu.. bet paraleeli uzjautaasu - interesee vienkars file uploads, visticamaaak *jpg, *png, *flv vairaak vai mazaak.. (vairaak domaats kaa papildmaterials noteiktam rakstam) un varbut kaadi ieteikumi, ierosinajumi , thx =) Quote Link to comment Share on other sites More sharing options...
mefisto Posted May 23, 2010 Report Share Posted May 23, 2010 http://lmgtfy.com/?q=php+file+upload&l=1 Quote Link to comment Share on other sites More sharing options...
mefisto Posted May 23, 2010 Report Share Posted May 23, 2010 if(@move_uploaded_file($_FILES[$upload_name]['tmp_name'], $target)){ echo "There was a problem with the upload"; }else { echo "Sorry, there was a problem uploading your file."; } Tāpēc ka te ir drukas kļuda , abi paziņojumi saka ka upload's nav izdevies. Quote Link to comment Share on other sites More sharing options...
briedis Posted May 23, 2010 Report Share Posted May 23, 2010 Izskatās vareni līkdz kods, ar kaut kādiem mainīgajiem, kas izskatās, ka nemaz netiek izmantoti :) Varbūt pameklē ko labāku... Quote Link to comment Share on other sites More sharing options...
mefisto Posted May 23, 2010 Report Share Posted May 23, 2010 http://lv.php.net/manual/en/function.move-uploaded-file.php Ņem tik un lasi ( arī komentārus ) Quote Link to comment Share on other sites More sharing options...
mounkuls Posted May 23, 2010 Report Share Posted May 23, 2010 Ajjj, nu kāpēc neklausi ko mefisto iesaka? Tur patiešām ir labi piemēri komentāros. To kko tadu atradu neiesaku, bet darīšana jau Tava. Quote Link to comment Share on other sites More sharing options...
php newbie Posted May 24, 2010 Report Share Posted May 24, 2010 nja neko nevar saprast. kaut kādi 2 nesaistīti koda gabali. vai tā save metode ir upload klases metode? bezsakars, vai nu es esmu pastulbs Quote Link to comment Share on other sites More sharing options...
mefisto Posted May 24, 2010 Report Share Posted May 24, 2010 Kāpēc tu mēģini rakstīt objektorientētu kodu, ja tu pat nesaproti PHP pamatus ? Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted May 24, 2010 Report Share Posted May 24, 2010 o_O vaaa? Quote Link to comment Share on other sites More sharing options...
xPtv45z Posted May 24, 2010 Report Share Posted May 24, 2010 Tu jau saproti, ka šajā vietā tev $upload satur objektu ar tukšiem, vai ar kaut kādiem defaultajiem parametriem? $upload = new Upload(); $foto = $upload->getFilenameFoto(); Izdrukā var_dump($upload); un apskaties, ko kurā brīdī viņš satur. Quote Link to comment Share on other sites More sharing options...
php newbie Posted May 24, 2010 Report Share Posted May 24, 2010 (edited) nu protams, jo tajās metodēs ir dažādas upload klases instances uztaisi klases globālo mainīgo(laikam tā to sauc) http://php.net/manual/en/language.oop5.php tur daudz visādi piemēri edit: ops izskatās ka vienkārši katrā metodē tiek taisīta jauna instance :) Edited May 24, 2010 by php newbie Quote Link to comment Share on other sites More sharing options...
php newbie Posted May 24, 2010 Report Share Posted May 24, 2010 nevajag katru reizi rakstīt $upload = new Upload(); jo šitais veido jaunu tukšu instanci vienreiz kaut kur sākumā inicializē un viss Quote Link to comment Share on other sites More sharing options...
briedis Posted May 24, 2010 Report Share Posted May 24, 2010 Uztaisi statiskas metodes, ja nedomā paralēli augšuplādēt vairākus failus ;) Quote Link to comment Share on other sites More sharing options...
php newbie Posted May 25, 2010 Report Share Posted May 25, 2010 vari to darīt __construct() metodē. tā izpildas kad veido jaunu klases instanci. laikam tā bija... Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted May 25, 2010 Report Share Posted May 25, 2010 Es jau saprotu, ka taa ir pagaatne un taa, bet var jau sho to palasiit pirms raksta lietas :/ Tev tak nav ne mazaakaa saprashana par OOP. Raksti proceduraali - kam tev uzspiest OOP? new Upload() tev izveido jaunu OBJEKTU - viss ko tu saglabaaji kaadaa citaa objektaa tev nebuus pieejams. Domaa par to, kaa tas ir cits masiivs, kursh nekaadaa veidaa nav saistiits ar pirmo masiivu. Vieniigaa kopiigaa lieta, ka tu vari lietot taas pashas metodes un izmantot tos mainiigos (bet veertiibas buus citas). Atkal kaa jau masiivs. Vari izmantot visas array_pop, array_diff metodes un likt klaat jaunas veertiibas klaat masiivaa, bet taas nekaadaa veidaa nesinhronizeejas. Protams vienmeer jau var izmantot statiskas metodes un propertijus, bet ja viss tiks taisiits tieshi taa, tad kaada jeega no OOP? class Upload { private static $file_name; public static function set_file_name($file_name) { self::$file_name = $file_name; } public static function get_file_name() { return self::$file_name; } } class History { public function save() { $foto = Upload::get_file_name(); } } Upload::set_file_name('learn_stuff.gif'); $history = new History; $history->save(); Ja gribi izmantot objektu tad: class Upload { private $file_name; public function set_file_name($file_name) { $this->file_name = $file_name; } public function get_file_name() { return $this->file_name; } } class History { public function save($upload) { $foto = $upload->get_file_name(); } } $upload = new Upload; $upload->set_file_name('learn_stuff.gif'); $history = new History; $history->save($upload); Mantoshanu vajag izmantot, ja tieshaam vajag kaut ko mantot nevis padot mainiigo... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.