Reputation:
I have problem displaying my image after I upload my coding to online web hosting. When I do in my localhost, I the image manage to retrieve out and manage to move to the accessory folder. But when I try in online, the image upload do not move to the accessory folder that store the image and cannot be retrieve out. Below is my code:
adminadd.php
<?php
session_start();
$connect = mysqli_connect("localhost", "root", "", "db_name");
if(isset($_POST['submit'])){
$name=$_POST['name'];
$description=$_POST['description'];
$image = $_FILES['image']['name'];
$image_temp = $_FILES['image']['tmp_name'];
move_uploaded_file($image_temp,"accessory/".$image);
$price=$_POST['price'];
$category=$_POST['category'];
$query="INSERT INTO product (name,product_description,price,catid,image) VALUES ('$name','$description','$price','$category','$image')";
if(mysqli_query($connect, $query)){
echo "<script>alert('Successfully inserted')</script>";
}
}
?>
Can someone enlighten me with my problem. Appreciate alot.
Upvotes: 0
Views: 56
Reputation: 944530
The destination needs to be a filename, not a URL.
Typically, it is not possible to write to HTTP URLs (it requires the server to be set up to allow it, and for you to make a PUT request with appropriate authentication … move_uploaded_file
can't do that).
Change http://fypesystem.com/Shineacc/accessory/
to a directory path on your server's filesystem.
Upvotes: 2