Jump to content
php.lv forumi

Problēmas ar bildes augšupielādēšanu


Jamesons

Recommended Posts

Lūk man ir šāda te augšupielādēšanas sitēma:

HTML (inputs):

<body bgcolor="#34AB47"
<form action="upload.php" method="post" enctype="multipart/form-data">
<br><p><strong>Augšupielādēt bildes:</strong><br>
<br><input type="file" name="pictures[]" /></br>
<br><input type="file" name="pictures[]" /></br>
<br><input type="file" name="pictures[]" /></br>
<br><input type="file" name="pictures[]" /></br>
<br><input type="file" name="pictures[]" /></br>
<br><input type="file" name="pictures[]" /></br>
<br><input type="submit" value="Augšupielādēt" /></br>
</p>
</form>
</body>

Tālāk ir upload.php fails, caur kuru tiek lādētas bildes iekšā:

<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

$uploaddir = '/var/www/atteli/rozu_laukums/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

?>

 

Nospiežot pogu Augšupielādēt izlec sekojošs errors:

Possible file upload attack!
Here is some more debugging info:Array
(
[pictures] => Array
	(
		[name] => Array
			(
				[0] => bg.jpg
			)

		[type] => Array
			(
				[0] => image/jpeg
			)

		[tmp_name] => Array
			(
				[0] => C:\WINDOWS\Temp\php6DFB.tmp
			)

		[error] => Array
			(
				[0] => 0
			 )

		[size] => Array
			(
				[0] => 133721
			  )
)

)

 

 

Atvainojos, ka posts varbūt ir par garu, bet kāds zin, kas par problēmu varētu būt?

paldies jau iepriekš.

Edited by Jamesons
Link to comment
Share on other sites

×
×
  • Create New...