php - When I'm upload picture to 000webhost is not truely uploaded always 0.1kb that stored -
hi i'm new php language , trying upload picture web host, , i'm using www.000webhost.com, have problem upload when i'm trying upload picture using postman show success, when i'm check in file manager show 0.1kb. this when testing using postman when check file manager
and code
databaseconfig.php
<?php $hostname = "localhost"; $hostuser = "id2880262_leonheart"; $hostpass = "123456"; $databasename = "id2880262_db_image"; ?>
img_upload_to_server.php
<?php include 'databaseconfig.php'; // create connection $conn = new mysqli($hostname, $hostuser, $hostpass, $databasename); if ($_server['request_method'] == 'post') { $defaultid = 0; $imagedata = isset($_post['path_name']) ? $_post['path_name']:''; $imagename = isset($_post['name_commend']) ? $_post['name_commend']:''; $getoldidsql = "select id image_upload order id asc"; $query = mysqli_query($conn,$getoldidsql); if ($query == false){ die(mysqli_close($query)); } else{ while ($row = mysqli_fetch_array($query)) { $defaultid = $row['id']; } } $imagepath = "images/$defaultid.png"; $serverurl = "https://androidplayground.000webhostapp.com/$imagepath"; $insertsql = "insert image_upload (path_name,name_commend) values ('$serverurl','$imagename')"; if (mysqli_query($conn, $insertsql)) { file_put_contents($imagepath, utf8_decode($imagedata)); echo "upload complete. thank trying"; } mysqli_close($conn); }else{ echo "not uploaded"; } ?>
so how upload full size of picture?
thank helping before.
Comments
Post a Comment