friends,
Who could help myself below in my code to insert the complete road when I do an uploading of an image. the problem is that when I make the uploading just the name of the image is going to group of data (bd) and I wanted him to be the address where would be the images.
or be: .. /.. /../image/image.jpg
below it is my code... help me
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/gresil_conexao.asp" -->
<!--#include file="../../includes/common/KT_common.asp" -->
<!--#include file="../../includes/tNG/tNG.inc.asp" -->
<%
'Make a transaction dispatcher instance
Dim tNGs: Set tNGs = new tNG_dispatcher
tNGs.Init "../../"
%>
<%
' Start trigger
Dim formValidation: Set formValidation = new tNG_FormValidation
formValidation.Init
tNGs.prepareValidation formValidation
' End trigger
%>
<%
'start Trigger_FileUpload trigger
'remove this line if you want to edit the code by hand
Function Trigger_FileUpload (ByRef tNG)
Dim uploadObj: Set uploadObj = new tNG_FileUpload
uploadObj.Init tNG
uploadObj.setFormFieldName "Foto"
uploadObj.setDbFieldName "Foto"
uploadObj.setFolder "../../d/"
uploadObj.setMaxSize 1500
uploadObj.setAllowedExtensions "pdf, txt, jpg"
uploadObj.setRename "auto"
Set Trigger_FileUpload = uploadObj.Execute()
End Function
'end Trigger_FileUpload trigger
%>
<%
' Make an insert transaction instance
Dim ins_bateria_cadastro: Set ins_bateria_cadastro = new tNG_insert
ins_bateria_cadastro.init MM_gresil_conexao_STRING
tNGs.addTransaction ins_bateria_cadastro
' Register triggers
ins_bateria_cadastro.registerTrigger Array("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1")
ins_bateria_cadastro.registerTrigger Array("BEFORE", "Trigger_Default_FormValidation", 10, formValidation)
ins_bateria_cadastro.registerTrigger Array("END", "Trigger_Default_Redirect", 99, "../html/validacao_cadastro_ritmista.html")
ins_bateria_cadastro.registerTrigger Array("AFTER", "Trigger_FileUpload", 97)
' Add columns
ins_bateria_cadastro.setTable "bateria_cadastro"
ins_bateria_cadastro.addColumn "Foto", "FILE_TYPE", "FILES", "Foto", ""
ins_bateria_cadastro.setPrimaryKey "Código", "NUMERIC_TYPE", "", ""
%>
<%
'Execute all the registered transactions
tNGs.executeTransactions
%>
<%
'Get the transaction recordset
Dim rsbateria_cadastro
Dim rsbateria_cadastro_numRows
Set rsbateria_cadastro = tNGs.getRecordset("bateria_cadastro")
rsbateria_cadastro_numRows = 0
%>
<html>
<head>
<title>GRESIL - BATERIA SWING DA LEOPOLDINA</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<script src="../../includes/common/js/base.js" type="text/javascript"></script>
<script src="../../includes/common/js/utility.js" type="text/javascript"></script>
<script src="../../includes/skins/style.js" type="text/javascript"></script>
<% Response.Write tNGs.displayValidationRules()%>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<p>
<%
Response.Write tNGs.getErrorMsg()
%>
<form method="post" id="form1" action="<%= KT_escapeAttribute(KT_getFullUri()) %>" enctype="multipart/form-data">
<table cellpadding="2" cellspacing="0" class="KT_tngtable">
<tr>
<td class="KT_th"><label for="Foto">Foto:</label></td>
<td><input type="file" name="Foto" id="Foto" size="32" />
<%=(tNGs.displayFieldError("bateria_cadastro", "Foto"))%></td>
</tr>
<tr class="KT_buttons">
<td colspan="2"><input type="submit" name="KT_Insert1" id="KT_Insert1" value="Insert record" /></td>
</tr>
</table>
</form>
<p> </p>
<p> </p>
</p>
</body>
</html>