Yes it can, with correct setup at the server, the correct php file, and the correct blocks in AI2
Again, you do not show, in their entirety, your relevant blocks....
Before, we uploaded a cat. Now, we are going to upload a dog.
borrar_sube3.aia (166.8 KB)
<?php
// 1.- IDENTIFICACION nombre de la base, del usuario, clave y servidor
$db_host="localhost";
$db_name="id1975555_base"; // fake
$db_login="id1975555_juan"; // fake
$db_pswd="Contraseña"; // fake
// 2.- CONEXION A LA BASE DE DATOS
$link = new mysqli($db_host, $db_login, $db_pswd, $db_name);
// 3.- OBTENER ARCHIVO - GET FILE
$file = file_get_contents('php://input');
if (file_put_contents($_GET['archivo'],$file == TRUE)) {
$nombre = $_GET['archivo'];
$extension = pathinfo($nombre, PATHINFO_EXTENSION);
// $extension = mime_content_type($nombre);
// Archivo a MySQLi. BLOB. - File to MysQLi BLOB.
$blob = mysqli_real_escape_string($link, $file);
$resultado = mysqli_query($link, "INSERT INTO dibujos (imagen, extension, nombre) VALUES ('$blob', '$extension', '$nombre')");
mysqli_close($link);
echo $nombre." uploaded.";
} else {
echo "Error";
}
?>
Here it is!
Can you adjust this to store an image just taken with the camera ?
Does my example work for you? can you upload the perro.png file to your database?
I'm sure it works. It's not finding the directory. A small issue. Can you please change the above blocks to allow picking an image from your phone.
You do not need to make a fullPath, just use the path in Etiqueta3.Text.
Use Do It when using companion to see the values that are being generated. You learn a lot about how to debug your own work....
Did you use Do It to see what each variable/action is being returned? from that you can work out the correct file path you need to set.
Can a host block transferring BLOB data. I have copied these BLOCKS and code exactly and the name arrives in the database but not the BLOB.
In the example borrar_sube3.aia you answered: "I'm sure it works. It's not finding the directory." does that mean that it worked for you or that it didn't work for you?
Juan, I downloaded your code. I uploaded a trial image to the media folder. I copied your PHP exactly. I ran the APP. The image name and extension loaded to the database and the file manager. The BLOB did not. This must be a hosting issue and I opened a ticket with them.
Create and upload to your server a file called info.php with this content:
<?php
phpinfo();
?>
Open it...
https://domain.abc/.../info.php
Check if file_uploads is on