Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
primera versión funcional aplicación PHP subir archivos
- Loading branch information
0 parents
commit 01ad018
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+97.4 KB
archivos/PHP script to calculate the differences between two dates.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
foreach($_FILES["miarchivo"]['tmp_name'] as $key => $tmp_name) | ||
{ | ||
//condicional si el fuchero existe | ||
if($_FILES["miarchivo"]["name"][$key]) { | ||
// Nombres de archivos de temporales | ||
$archivonombre = $_FILES["miarchivo"]["name"][$key]; | ||
$fuente = $_FILES["miarchivo"]["tmp_name"][$key]; | ||
|
||
$carpeta = 'archivos/'; //Declaramos el nombre de la carpeta que guardara los archivos | ||
|
||
if(!file_exists($carpeta)){ | ||
mkdir($carpeta, 0777) or die("Hubo un error al crear el directorio de almacenamiento"); | ||
} | ||
|
||
$dir=opendir($carpeta); | ||
$target_path = $carpeta.'/'.$archivonombre; //indicamos la ruta de destino de los archivos | ||
|
||
|
||
if(move_uploaded_file($fuente, $target_path)) { | ||
echo "Los archivos $archivonombre se han cargado de forma correcta.<br>"; | ||
} else { | ||
echo "Se ha producido un error, por favor revise los archivos e intentelo de nuevo.<br>"; | ||
} | ||
closedir($dir); //Cerramos la conexion con la carpeta destino | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=utf-8> | ||
<title>Capturar pantalla del sitio web desde URL PHP</title> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | ||
<script src="https://code.jquery.com/jquery-3.2.1.min.js" ></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" ></script> | ||
<style type="text/css"> | ||
* { | ||
font-family:Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, sans-serif | ||
} | ||
.main { | ||
margin:auto; | ||
border:1px solid #7C7A7A; | ||
width:70%; | ||
text-align:left; | ||
padding:30px; | ||
background:#85c587 | ||
} | ||
input[type=submit] { | ||
background:#6ca16e; | ||
width:100%; | ||
padding:5px 15px; | ||
background:#ccc; | ||
cursor:pointer; | ||
font-size:16px; | ||
} | ||
input[type=text] { | ||
width:40%; | ||
padding:5px 15px; | ||
height:25px; | ||
font-size:16px; | ||
} | ||
.form-control { | ||
padding: 0px 0px; | ||
} | ||
</style> | ||
</head> | ||
<body bgcolor="#bed7c0"> | ||
<br> | ||
<div class="main"> | ||
<h1>Cargar múltiples archivos PHP</h1> | ||
<div class="panel panel-primary"> | ||
<div class="panel-body"> | ||
<form name="MiForm" id="MiForm" method="post" action="cargar.php" enctype="multipart/form-data"> | ||
<h4 class="text-center">Cargar Múltiple Archivos</h4> | ||
<div class="form-group"> | ||
<label class="col-sm-2 control-label">Archivos</label> | ||
<div class="col-sm-8"> | ||
<input type="file" class="form-control" id="miarchivo[]" name="miarchivo[]" multiple=""> | ||
</div> | ||
<button type="submit" class="btn btn-primary">Cargar Multiple</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |