So, long story short, I have a LXC using a template of Ubuntu, where I'm running Apache2, and I have a little and simple code in /var/www/html/index.html
.
The problem is I'm not sure I have the proper directory where I'm saving the uploaded images. Currently I'm keeping it in: /var/www/html/uploads
.
I'm thinking maybe I should indicate something like: [SERVER_IP]:/var/www/html/uploads/
.
But, yeah. I haven't figured out how to fix it.
edit: here's the code:
<?php
if(isset($_POST["submit"])){
$filebasename = basename($_FILES['upfile']['name']);
$desired_dir=$_SERVER['DOCUMENT_ROOT']. "uploads/";
echo $desired_dir;
$file_name = $_FILES['upfile']['name'];
if (file_exists($desired_dir . $file_name)){
$message = $file_name . "el archivo ya existe";
} else {
move_uploaded_file($_FILES["upfile"]["tmp_name"], $desired_dir . $file_name);
$message = $file_name . "Cargado exitosamente";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP Carga de Imagenes</title>
<body>
<h2>Carga de Imagenes</h2>
<form action="" enctype="multipart/form-data" method="post" name="upl_frm">
Selecciona la imagen <input type="file" name="upfile" />
<input name="submit" type="submit" value="Cargar" />
<?php
if(!empty($message)){
echo $message;
}
?>
</form>
</body>
</html>