Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/05/2005, 23:22
Imelda
 
Fecha de Ingreso: mayo-2005
Mensajes: 5
Antigüedad: 18 años, 11 meses
Puntos: 0
Exclamación

Perdona,
el siguiente código es el que estoy usando para bajar Archivos los archivos:
//este código se manda llamar desde una forma en la que viene el nombre del archivo a bajar y luego manda los parámetros para que éste código lo baje...

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?
$conexion = mysql_connect("localhost","root","");
mysql_select_db ("sedec_db", $conexion) OR die ("No se puede conectar");
$stringquery = "SELECT * FROM investigador Where cur<>'' and cur<>'N/A' and cve=".$_REQUEST['clave'];
$RESULT = mysql_query($stringquery);
$row = mysql_fetch_array($RESULT);
$arch=$row['cur'];
header("Pragma: public");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=".basename($arch).";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($arch));

readfile("$arch");
exit();

?>
<form name="form1" method="post" action="">
<input type="submit" name="Submit" value="Submit">
<?

?>
</form>
</body>
</html>
---
Y esta es la parte que uso para subir el archivo y crear el directorio de currículums
if(isset($_POST['Guardar'])){
if($_POST['Guardar']==true){
$fecha = $_REQUEST['fecha'];
$guarda=true;
if ($HTTP_POST_FILES['Archivo']['name'] != ""){
$cur=$HTTP_POST_FILES['Archivo']['name'];
$sql = "Select * From investigador Where cur='$cur' and cve<>".$_COOKIE['usCve'];
$sql = mysql_query($sql, $conexion);
if(mysql_fetch_array($sql)){
$guarda=false;
?>
<script language="JavaScript" type="text/JavaScript">
alert("El nombre del Curriculum ya existe, favor de cambiarlo");
</script>
<?
}
else{
if(!(is_dir("Curriculums_Miembros"))){
mkdir("Curriculums_Miembros");
}
copy($HTTP_POST_FILES['Archivo']['tmp_name'],"Curriculums_Miembros/".$HTTP_POST_FILES['Archivo']['name']);
}
}
else{
$cur="N/A";
}
if($guarda){
$sql="Update investigador Set cur= '$cur', fecha = '".$_REQUEST['fecha']."' Where cve =".$_REQUEST['cve'];
mysql_query($sql, $conexion);
?>
<script language="JavaScript">
window.location = "<? echo "MenuCenEinv.php?u=".$_REQUEST['u']."&t=2&c=".$_REQUEST['cve']; ?>";
</script>
<?
}
}
}

Puedes ayudarme?, el problema es que al bajarlo no trae contenido... sólo los .txt =(