Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/11/2003, 10:14
XMAlex
 
Fecha de Ingreso: octubre-2003
Ubicación: En Caracas
Mensajes: 4
Antigüedad: 20 años, 5 meses
Puntos: 0
algunos inconveniente



Hola FOREROS, les agradesco de ante mano la atencion prestada y sus ayuda que son lo MAXIMO

Deseo guardar la ruta de un archivo en el servidor que por medio del codigo se puede subir, dicha ruta del archivo tengo que almacenarla en una base de datos, para asi poderla vincular auntomaticamente, pero no lo he podido lograr aun!!!!!!

Aqui les mando el codido para que le den un vistazo

<?php require_once('Connections/configuracion.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO periodico (autor, titulo, noticia, sesion, imagen, fecha) VALUES (%s, %s, %s, %s, %s, NOW())",
GetSQLValueString($HTTP_POST_VARS['autor'], "text"),
GetSQLValueString($HTTP_POST_VARS['titulo'], "text"),
GetSQLValueString($HTTP_POST_VARS['noticia'], "text"),
GetSQLValueString($HTTP_POST_VARS['sesion'], "text"),
GetSQLValueString($HTTP_POST_VARS['archivo'], "text"));


mysql_select_db($database_configuracion, $configuracion);
$Result1 = mysql_query($insertSQL, $configuracion) or die(mysql_error());
}

mysql_select_db($database_configuracion, $configuracion);
$query_rs = "SELECT * FROM periodico ORDER BY id ASC";
$rs = mysql_query($query_rs, $configuracion) or die(mysql_error());
$row_rs = mysql_fetch_assoc($rs);
$totalRows_rs = mysql_num_rows($rs);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pro Joven</title>
<meta http-equiv="" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
color: #FFFFFF;
}
a {
text-decoration: none;
}
-->
</style>
<meta http-equiv="" content="text/html; charset=iso-8859-1"><meta http-equiv="" content="text/html; charset=iso-8859-1"><meta http-equiv="" content="text/html; charset=iso-8859-1"><meta http-equiv="" content="text/html; charset=iso-8859-1"><meta http-equiv="" content="text/html; charset=iso-8859-1"><meta http-equiv="" content="text/html; charset=iso-8859-1"><meta http-equiv="" content="text/html; charset=iso-8859-1"><meta http-equiv="" content="text/html; charset=iso-8859-1"></head>
<body bgcolor="#0099CC" text="#FFFFFF" link="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
<!--DWLayoutTable-->
<tr>

<td width="730" height="156" valign="middle"> <div align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="730" height="156">
<param name="wmode" value="transparent">
<param name="movie" value="animacionespu/logo3.swf">
<param name="quality" value="high">
<embed src="animacionespu/logo3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="730" height="156"></embed></object>
</div></td>
</tr>
</table>


<table width="765" border="1" align="center" cellpadding="2" cellspacing="2">

<!--DWLayoutTable-->
<tr>
<td width="753" height="54" valign="top" bgcolor="#0033CC">
<h2 align="center">Peri&oacute;dico
Pro Joven </h2>
<div align="right">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="85" height="25">
<param name="movie" value="inicio.swf">
<param name="quality" value="high">
<param name="base" value=".">
<param name="bgcolor" value="#0033CC">
<embed src="inicio.swf" base="." quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="85" height="25" bgcolor="#0033CC"></embed>
</object>
</div></td>
</tr>
<tr>
<td height="25" align="center" valign="middle" bgcolor="#0033CC"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="750" height="45">
<param name="wmode" value="transparent">
<param name="movie" value="animacionespu/tituloenvio.swf">
<param name="quality" value="high">
<embed src="animacionespu/tituloenvio.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="750" height="45"></embed></object></td>
</tr>
</table>




<form enctype="multipart/form-data" method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table width="765" background="imagen/cuadro%20formulario.png">
<!--DWLayoutTable-->
<tr>
<td width="189" height="45">&nbsp;</td>
<td width="357">&nbsp;</td>
<td width="197">&nbsp;</td>
</tr>
<tr>
<td height="302">&nbsp;</td>
<td valign="top"> <table width="354" align="center">
<!--DWLayoutTable-->
<tr valign="baseline">
<td width="53" height="24" align="right" valign="middle" nowrap><font color="#000000">Autor:</font></td>
<td width="285" valign="top"><font color="#000000">
<input type="text" name="autor" value="" size="32">
</font></td>
</tr>
<tr valign="baseline">
<td height="24" align="right" valign="middle" nowrap><font color="#000000">Titulo:</font></td>
<td valign="top"><font color="#000000">
<input type="text" name="titulo" value="" size="32">
</font></td>
</tr>
<tr valign="baseline">
<td height="104" align="right" valign="middle" nowrap><font color="#000000">Noticia:</font></td>
<td valign="top"><font color="#000000">
<textarea name="noticia" cols="42" rows="5"></textarea>
</font></td>
</tr>
<tr valign="baseline">
<td height="26" align="right" valign="middle" nowrap><font color="#000000">Sesion:</font></td>
<td valign="top"> <font color="#000000">
<select name="sesion">
<option value="1" >Ciudadania</option>
<option value="2" >Cultura de Paz</option>
<option value="3" >Genero</option>
<option value="4" >Noticia</option>
</select>
</font></td>
</tr>
<tr valign="baseline">
<td height="24" align="right" valign="middle" nowrap><font color="#000000">Imagen:</font></td>
<td valign="top"><font color="#000000">
<input name="userfile[]" type="file" id="userfile" maxlength="100" >
</font></td>
</tr>
<tr valign="baseline">
<td height="26" colspan="2" align="center" valign="middle" nowrap><input type="submit" value="Insertar registro">
</td>
</tr>
</table>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="9"></td>
<td></td>
<td></td>
</tr>
</table>

<input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>
<?
$N = 1; //Número de archivos a Subir

for($i=0; $i<$N; $i++) {

if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'][$i])) {

$split_path = split("/", $HTTP_POST_FILES['userfile']['name'][$i]);
$split_path = end ($split_path);
$extension = split("[/.]", $split_path);

if (end($extension) == "php" || end($extension) == "php3") && (end($extension) != "jpg" || end($extension) != "png" || end($extension) != "bmp" || end($extension) != "dib"){

echo "tipo de archivo invalido";

} else {

$RUTA_UPLOADED = "images de reportajes/";

$NOMBRE_FILE = "NUEVO_NOMBRE_DE_TU_ARCHIVO_" . "." . end($extension);
move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'][$i], $RUTA_UPLOADED . $HTTP_POST_FILES['userfile']['name'][$i]);

$archivo = $RUTA_UPLOADED . $HTTP_POST_FILES['userfile']['name'][$i];
}
}
}
}
?>

<?php

mysql_free_result($rs);
?>