Tuesday, December 17, 2019

Paying with images in php coding






Source code:

upload.php

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Himel Sarlar</title>
<link rel="stylesheet" href="">
</head>
<body>

<form enctype="multipart/form-data" action="welcome2.php" method="POST" accept-charset="utf-8">
<input type="file" name="profilepicture">
<input type="submit" value="UPLOAD">
</form>

</body>
</html>


---------------------------------------------------------------------------------------------------------------------

welcome2.php




<pre>
<?php



$p=$_FILES["profilepicture"];
echo var_dump($p)."<br>";
//echo var_dump($p);
$p["tmp_name"];
$f=$p["name"];
echo $p["tmp_name"];

  $s=floor(($p["size"]/1000));

if ($s>1000) {
echo "<br>".($s/1000)." MB";
} else {
echo  "<br>".$s." KB <br>";

}
echo "<br>tmp_name:".$p["tmp_name"];
move_uploaded_file($p["tmp_name"],"img/".$p["name"]);

echo "<img src='img/$f' >";
?>

</pre>



0 comments:

Post a Comment