Ver Mensaje Individual
  #8 (permalink)  
Antiguo 25/05/2009, 13:52
Avatar de chulifo
chulifo
 
Fecha de Ingreso: abril-2009
Ubicación: perdido en codigos del PHP, pero aprendo rapido!
Mensajes: 524
Antigüedad: 15 años, 1 mes
Puntos: 18
Respuesta: Ayuda a completar mi sistema fileupload

Cita:
Iniciado por harvestmoon Ver Mensaje
eso te abrira los archivos que tienes en la carpeta
saludines y perdon la tardanza
muak!
Oe man mira estos son los codigos y archivos que hasta ahora tengo
index.php
Código PHP:
<head>
<script language="JavaScript">
function Abrir_ventana (pagina) {
var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=508, height=365, top=85, left=140";
window.open(pagina,"",opciones);
}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File Manager</title>
<script src='texts.js'></script>
<style type="text/css">
<!--
.style1 {
    font-size: 18px;
    font-weight: bold;
}
-->
</style>
</head>

<body>
<form enctype="multipart/form-data" action="<?=$PHP_SELF?>subir.php" method="POST">
  <p>
    <input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
  selecciona los archivos que quieres subir</p>
  <p>
    <input name="uploadedfile" type="file" />
  </p>
  <p>
    <input name="uploadedfile2" type="file" />
  </p>
  <p>
    <label></label>
    <br />
    <input type="submit" value="Subir Mi Archivo" />
  </p>
  
</form>
Actualemte Estos son los archivos existentes
<p>

  <? $dir = new DirectoryIterator('files/');//Aqui se indica la ruta 
while($dir->valid()) { 
if(!
$dir->isDot()) { 
$num++; 
print(
"<TD bgcolor=#FFCCFF>"."<a href=javascript:Abrir_ventana('scripparabrir.php?$dir') ><img src=\"images.jpg\" /></font></a>"."</TD>\n"); 


$dir->next('files/'); 


?>
</p>
  </body>
</html>

subir.php

Código PHP:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
a:link {
    color: #000000;
    text-decoration: none;
}
a:visited {
    text-decoration: none;
    color: #000000;
}
a:hover {
    text-decoration: none;
    color: #FF0000;
}
a:active {
    text-decoration: none;
    color: #000000;
}
-->
</style></head>

<body>
<?php
// Where the file is going to be placed  
$target_path "files/"

/* Add the original filename to our target path.   
Result is "uploads/filename.extension" */ 
$target_path $target_path basename$_FILES['uploadedfile']['name']);  

$target_path "files/"

$target_path $target_path basename$_FILES['uploadedfile']['name']);  

if(
move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { 
    echo 
"El Archivo ".  basename$_FILES['uploadedfile']['name']).  
    
"\r\n\r\n.Subio exitosamente \r\n\r\n."
} else{ 
    echo 
"error en el upload 1. \r\n\r\n."
}  

// Where the file is going to be placed  
$target_path "files/"

/* Add the original filename to our target path.   
Result is "uploads/filename.extension" */ 
$target_path $target_path basename$_FILES['uploadedfile2']['name']);  

$target_path "files/"

$target_path $target_path basename$_FILES['uploadedfile2']['name']);  

if(
move_uploaded_file($_FILES['uploadedfile2']['tmp_name'], $target_path)) { 
    echo 
"EL Archivo ".  basename$_FILES['uploadedfile2']['name']).  
    
"Subio exitosamente \r\n\r\n."
} else{ 
    echo 
"error en el upload2. \r\n\r\n."
}  
//aki se seecciona los archivos XD solo asi me acuerdo!

?>
<p><strong> <a href="index.php"><em>Vuelve para ver tus archivos</em></a></strong></p>
</body>
</html>
borrar.php
Código PHP:
<? php
unlink
=("files/$dir"); 
?>
y todo va bien peroen el uñtimo archivo borrar.php me tira este error y nose que hacer creo que esta sera la ultima duda sobre este tema!
Cita:
Parse error: syntax error, unexpected T_STRING in C:\AppServ\www\upload\borrar.php on line 2

gracias espero tu respuesta o de otros user!