Image in data base SQL

hello
I make an app with upload image in data base and sql connect, but when upload image in directory came only .jpg file without anything into it.

Blockquote<?php

DEFINE (‘DBUSER’, 'user. . . ');

DEFINE (‘DBPW’, 'pass. . . ');

DEFINE (‘DBHOST’, ‘localhost’);

DEFINE (‘DBNAME’, ‘dbName. . .’);

$dbc = mysqli_connect(DBHOST,DBUSER,DBPW);
mysqli_query($dbc, ‘SET NAMES utf8’);

if (!$dbc) {
die("Database connection failed: " . mysqli_error($dbc));
exit();
}

$dbs = mysqli_select_db($dbc, DBNAME);
if (!$dbs) {
die("Database selection failed: " . mysqli_error($dbc));
exit();
}

$target_dir = “PhotoUpload_BadRoads/”;
$target_file = $target_dir . basename($_FILES[“fileToUpload”][“name”]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);

$dataToWrite = $_REQUEST[‘fileName’];
$fileName = mysqli_real_escape_string($dbc,$_GET[‘picture_dir’]);
file_put_contents($fileName, $dataToWrite);

$name = mysqli_real_escape_string($dbc, $_GET[‘name’]);
$tel_number = mysqli_real_escape_string($dbc,$_GET[‘tel_number’]);
$comment = mysqli_real_escape_string($dbc,$_GET[‘comment’]);
$latitude = mysqli_real_escape_string($dbc,$_GET[‘latitude’]);
$longitude = mysqli_real_escape_string($dbc,$_GET[‘longitude’]);
$picture_dir = mysqli_real_escape_string($dbc,$_GET[‘picture_dir’]);
$data = mysqli_real_escape_string($dbc,$_GET[‘data’]);
$Recorder_id = mysqli_real_escape_string($dbc,$_GET[‘Recorder’]);

$query = “INSERT INTO Report_List_SQL (name, tel_number, comment, latitude, longitude, picture_dir, data, recorder_id) VALUES (’$name’, ‘$tel_number’, ‘$comment’, ‘$latitude’, ‘$longitude’, ‘$picture_dir’, ‘$data’, ‘$recorder_id’)”;

$result = mysqli_query($dbc, $query) or trigger_error("Query MySQL Error: " . mysqli_error($dbc));

mysqli_close($dbc);

?>

Blockquote

image

I am not sure whether this is possible at all.
One thing is that it is usually better to just store file names and not the binary contents of images in a data base.
The second thing is, that you are sending the file name and not the contents of the file. In any case you should read the contents first. By googling this:

app inventor send image to website

You will find several solutions.
Cheers, Ghica

use ftp to transfer the images to your server
I can offer the following extension for that https://puravidaapps.com/ftp.php
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

OK
Thank you for quick response.
I will try