Jump to content
php.lv forumi

Nepievienojas bilde


Zoom

Recommended Posts

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 Kods

P.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

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

//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

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 by Zoom
Link to comment
Share on other sites

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 by Zoom
Link to comment
Share on other sites

×
×
  • Create New...