
02/07/2008, 07:26
|
| | Fecha de Ingreso: octubre-2007
Mensajes: 18
Antigüedad: 17 años, 6 meses Puntos: 0 | |
Respuesta: Ayuda Cita:
Iniciado por Shiryu_Libra  podrias realizar lo siguiente
ya que primero guardas los datos del usuario(mencionaste el paso 1), podrias tomar el autonumerico de este usuario para el paso 2, guardarlo en una variable session (session("IDUSER")=rs("ID")), para al momento de realizar el upload de la foto renombrala en el mismo procedimiento, algo similar a esto mira
de esta manera te ahorrarias mas lineas de codigo y automaticamente quedaria con el nombre que te dicen que tienes que hacer  Gracias Shiryu_Libra, pero como quedaria algo asi? no lo eh probado y te pregunto porque te repito mucho de idea no tengo.
Código:
<html>
<head>
<title>Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.style1 {
text-align: center;
}
.priv {font-family:tahoma; font-size:10px; color:#8B8881;}
</style>
<script type="text/javascript">
<!--
function FP_preloadImgs() {//v1.0
var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}
function FP_swapImg() {//v1.0
var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
elm.$src=elm.src; elm.src=args[n+1]; } }
}
function FP_getObjectByID(id,o) {//v1.0
var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
return null;
}
// -->
</script>
</head>
<body text="#000000" style="background-color: #3C3330" onload="FP_preloadImgs(/*url*/'images/buttonE.jpg',/*url*/'images/buttonF.jpg')">
<%
'Intercepción de errores de VBScript en tiempo de ejecución
On Error Resume Next
' Definición de variables
Dim mySmartUpload
Dim intCount
Dim session("IDUSER")= rs("ID")
'Instanciación del objeto aspSmartUpload.SmartUpload
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
'Definición de las extensiones de archivo permitidas para uploading
mySmartUpload.AllowedFilesList = "jpg,gif,txt,doc,pdf"
'Definición del tamaño máximo del archivo a subir
mySmartUpload.MaxFileSize = 500000 'en bytes: 500 KB aprox.
mySmartUpload.Upload
If mySmartUpload.Form("enviar")="ok" Then
'Guardar el archivo en el disco del servidor
intCount = mySmartUpload.Files("foto1").SaveAs("/Upload_2008" & session("IDUSER"))
'Verificación de errores
If Err.number<>0 or intCount=0 Then
Response.Write("<P align=""center"">Se produjo el siguiente error: " & Err.description & "</P>")
Else
Response.Write("<P align=""center"">El archivo " & mySmartUpload.Files.item(1).Filename & " (" & mySmartUpload.Files.item(1).Size & " bytes) se subió con éxito al servidor.")
End If
err.clear
End If
' Se restituye la administración de errores a VB Script
On Error Goto 0
%>
<p class="style1"><a href="index.aspx">
<img style="border: 0" id="img1" src="images/buttonD.jpg" height="33" width="100" alt="Continuar" fp-style="fp-btn: Embossed Tab 9; fp-bgcolor: #3C3330" fp-title="Continuar" onmouseover="FP_swapImg(1,0,/*id*/'img1',/*url*/'images/buttonE.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img1',/*url*/'images/buttonD.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img1',/*url*/'images/buttonF.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img1',/*url*/'images/buttonE.jpg')"></a></p>
<table width="659" border="0" cellspacing="0" cellpadding="0" style="background:url(images/priv_bg.gif) top left repeat-x; margin:3 0 0 4px" align="center">
<tr>
<td height="30"><div class="priv" style="margin-left:264px ">Copyright 2008 © All rights reserved.
Términos de uso | Contáctenos</div></td>
</tr>
</table>
</body>
</html>
remarque con rojo lo agregado, defini la variable que me dijiste y acomode la ruta, esta bien asi? espero tu respuesta :( |