I'm making a simple PHP application which can upload an image to server.
I did it in my localhost, everything works well, but when I did it in real server. I mean web.com, it didn't work.
Here is my PHP script :
<?php
require "init.php";
$encoded_string=$_POST["encoded_string"];
$userfname=$_POST["userNameOf"];
$decoded_string=base64_decode($encoded_string);
$string= str_replace(' ','', $userfname);
$path="http://mybookshare.com/photos/" .$string. ".jpg";
file_put_contents($path,$decoded_string);
$query = "UPDATE user SET ProfPicture='$encoded_string' WHERE UserFN='$userfname' AND ProfPicture IS NULL";
$result = mysqli_query($conn, $query);
if($result) {
echo "success";
} else {
echo "failed";
}
mysqli_close($conn);
?>
The script is located in htdocs/app
, and the upload file destination of the picture is at htdocs/photos
Any help please?