Create a folder named files www.MiServidor.com/Archivos
to which you modify the permissions to be able to read, write and modify. I have a form in index.php
in which a name of an image and a file are inserted. When sending the form, execute a file PHP
which receives two POST
and performs an insert to a table here I pass the code.
include("../Conexion.php");
$Conexion = new Conexion(SERVIDOR,USUARIO,PASS,DB); //inicializo la base de datos
session_start();
$Nombre = $_POST["Nombre"]; //recibo el nombre de la imagen
$imagen = $_FILES["Imagen" ]; //recibo la imagen
$archi = "INSERT INTO Archivos VALUES (null,".$url.",'".$Nombre."')"; //Inserto un registro con el nombre y la url
$Conexion -> set_charset('utf8');
$Conexion->query($archi);
So far everything works fine, then I try to store the received file in the Archivos
folder that I created on the server with the following line
move_uploaded_file($_FILES[ $name ][ 'tmp_name' ],
$_SERVER['DOCUMENT_ROOT']."/Archivos/".$nombre);
but it does not store anything, however in my local server localhost
if you allow it, but in my rented server (Neubox.com) it does not allow me
NOTE: I only upload images png
then I share the code
include("../Conexion.php"); //incluyo la conexion
$Conexion = new Conexion(SERVIDOR,USUARIO,PASS,DB); //inicializo la base de datos
session_start();
$Nombre = $_POST["Nombre"]; //recibo el nombre de la imagen
$imagen = $_FILES["Imagen" ]; //recibo la imagen
$archi = "INSERT INTO Archivos VALUES (null,".$url.",'".$Nombre."')"; //Inserto un registro con el nombre y la url
$Conexion -> set_charset('utf8');
$Conexion->query($archi);
move_uploaded_file($_FILES[ $name ][ 'tmp_name' ],
$_SERVER['DOCUMENT_ROOT']."/Archivos/".$nombre.".png");
However, it does not mark any type of error, it just does not store anything.