Zoom Posted November 10, 2005 Report Share Posted November 10, 2005 Tatad man ir registresanas skripts, kur lietotajs var ielikt savu bildi. Bet man rada sadu kludu: Warning: Invalid argument supplied for foreach() in C:\Program Files\Apache Group\Apache2\htdocs\temp\logosanas\reg.php on line 42. Te bus KodsP.S bildes ieliksana skripts sakas no 42 rindinas lidz 49. Pec tam man bildes nosaukumam it ka vaidzetu ierakstities DB. Link to comment Share on other sites More sharing options...
php_Stopp Posted November 10, 2005 Report Share Posted November 10, 2005 (edited) tā īpaši cītīgi pārējo kodu neizskatīju, bet nu vai tas $_FILES["pictures"]["error"] ir masīvs (array) ? oops. atkal jau laikam negulētās naktis uzdarbojas :/ Edited November 10, 2005 by php_Stopp Link to comment Share on other sites More sharing options...
Zoom Posted November 10, 2005 Author Report Share Posted November 10, 2005 http://paste.php.lv/2828 pliks skripts strada Link to comment Share on other sites More sharing options...
Klez Posted November 10, 2005 Report Share Posted November 10, 2005 man tai vietaa vispaar tas foreach nepatiik .... foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "C:\Program Files\Apache Group\Apache2\htdocs\temp\logosanas\bildes/$name"); echo $name. '<br>'; } } aizstaaj ar if ($_FILES["pictures"]["error"] == 0 && strlen($_FILES["pictures"]["name"]) > 8){ $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "C:\Program Files\Apache Group\Apache2\htdocs\temp\logosanas\bildes\$name"); echo $name. '<br>'; } Link to comment Share on other sites More sharing options...
Zoom Posted November 10, 2005 Author Report Share Posted November 10, 2005 http://paste.php.lv/2829 bilde nepievienojas ;( Link to comment Share on other sites More sharing options...
Klez Posted November 11, 2005 Report Share Posted November 11, 2005 //bildes####################################################### if ($_FILES["pictures"]["error"] == 0 && strlen($_FILES["pictures"]["name"]) > 8){ $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "C:\Program Files\Apache Group\Apache2\htdocs\temp\logosanas\bildes/$name"); echo $name. '<br>'; }else print_r($_FILES["pictures"]); // Lai redz kas notiekaas //#####################BEIGAS###################### Link to comment Share on other sites More sharing options...
Zoom Posted November 11, 2005 Author Report Share Posted November 11, 2005 (edited) Array ( [name]=> Array ( [0] => einars2.png ) [type] => Array ( [0] => image/png ) [tmp_name] => Array ( [0] => C:\WINDOWS\phpE3.tmp ) [error] => Array ( [0] => 0 ) => Array ( [0] => 246386 ) ) tapat nekas nav... Edited November 11, 2005 by Zoom Link to comment Share on other sites More sharing options...
KAC Posted November 11, 2005 Report Share Posted November 11, 2005 a kur ir probleema? nemaaki panjemt gatavu piemeeru no manuaalja? http://lv.php.net/manual/en/features.file-upload.php Link to comment Share on other sites More sharing options...
Zoom Posted November 11, 2005 Author Report Share Posted November 11, 2005 (edited) Possible file upload attack!Here is some more debugging info:Array ( [userfile]=> Array ( [name] => augsa.jpg [type] => [tmp_name] => [error] => 2 => 0 ) ) Un tapat man ta bilde neparsutijas ;) Kaut vai nemu (parkopeju) skriptu no manuela pie vainas bija mana php versija Edited November 11, 2005 by Zoom Link to comment Share on other sites More sharing options...
Recommended Posts