SISTEMA DE BUSCA NAO ABRE O LINK. URGENTE
Pessoal, sou novato em ASP e estou tentando fazer um sistema para busca de arquivos.
Caso encontre o arquivo, ele me retorna o nome com o link para o download.
Até ai, está tudo bem.
Porém, quando clico no link, nada acontence.
Eu preciso que o usuáio baixe esse arquivo, mas ao clicar no link que aparece, nada ocorre, nem abre o link, e nem abre a acaixa de download..
Segue o código.
<%@ Language=[Ô]VbScript[Ô]%>
<HTML>
<HEAD>
<TITLE>.:: NPA - Sintetizando o Futuro - Farmacêutica, Alimentos, Cosmética, Agrícola, Pesquisa e Desenvolvimento. ::.</TITLE>
<style type=[Ô]text/css[Ô]>
<!--
.style1 {color: #0000FF}
-->
</style>
</HEAD>
<BODY bgColor=[Ô]#FFFFFF[Ô] Background=[Ô][Ô]>
<%
Dim Coloralt [ô] We define the color variable
If Request.Querystring([Ô]results[Ô]) = [Ô][Ô] Then
%>
<Center>
<H1 class=[Ô]style1[Ô]>Sistema para Download de NFe </H1>
<table width=[Ô]787[Ô] border=[Ô]1[Ô]>
<tr>
<td height=[Ô]72[Ô]><div align=[Ô]center[Ô]><img src=[Ô]images/codbarra.jpg[Ô] alt=[Ô]Codigo de Barras NPA[Ô] width=[Ô]385[Ô] height=[Ô]128[Ô]></div></td>
</tr>
<tr>
<td height=[Ô]28[Ô]><form action=[Ô]Busca.asp?results=results[Ô] target=[Ô]main_view[Ô] method=[Ô]post[Ô] name=[Ô]DaForm[Ô] >
<input type=[Ô]text[Ô] size=[Ô]80[Ô] name=[Ô]Criteria[Ô]>
<input type=[Ô]submit[Ô] name=[Ô]B1[Ô] class=[Ô]buttons[Ô] value=[Ô]Procurar[Ô]>
<input type=[Ô]reset[Ô] name=[Ô]B2[Ô] class=[Ô]buttons[Ô] value=[Ô]Limpar[Ô]>
</form></td>
</tr>
</table>
</Center>
<Table Border=[Ô]1[Ô] Cellpadding=[Ô]0[Ô] Cellspacing=[Ô]0[Ô] Width=[Ô]100%[Ô]>
<TR align=[Ô]Center[Ô] bgcolor=[Ô]silver[Ô]>
<TD Width=[Ô]50%[Ô]><Font Face=[Ô]Arial[Ô] Color=[Ô]#000000[Ô]>Número NFe </Font></TD>
<TD Width=[Ô]16%[Ô]><Font Face=[Ô]Arial[Ô] Color=[Ô]#000000[Ô]>Data da Emissão </Font></TD>
<TD Width=[Ô]16%[Ô]><Font Face=[Ô]Arial[Ô] Color=[Ô]#000000[Ô]>Última Modificação</Font></TD>
<TD Width=[Ô]16%[Ô]><Font Face=[Ô]Arial[Ô] Color=[Ô]#000000[Ô]>Tamanho</Font></TD>
</TR>
</TABLE>
<!-- The IFRAME Starts here -->
<IFRAME name=[Ô]main_view[Ô] src=[Ô][Ô] width=[Ô]100%[Ô] height=[Ô]300[Ô] marginwidth=[Ô]0[Ô] marginheight=[Ô]0[Ô]></IFRAME>
<!-- The IFRAME ends here -->
<%
Else
[ô] We start the if statement that checks if there is a criteria...
If Request.Form([Ô]Criteria[Ô]) = [Ô][Ô] Then
Response.Write([Ô]<H2 align=[Ô][Ô]center[Ô][Ô]>é preciso informar a chave de acesso !</H2>[Ô])
Else
Dim objFolder
Dim strSearchText
Dim objFSO
strSearchText = Request.Form([Ô]Criteria[Ô])
[ô] We Create the FSO and Folder objects
Set fso = Server.CreateObject([Ô]Scripting.FileSystemObject[Ô])
Set objFSO = Server.CreateObject([Ô]Scripting.FileSystemObject[Ô])
[ô] We define the Folder to Search
Set objFolder = objFSO.GetFolder([Ô]E:\home
pa3\Web\file[Ô])
Search objFolder
Function Search(ByVal objFolder)
Dim objSubFolder
session([Ô]intMatch[Ô]) = 0
[ô]Loop through every file in the current folder
For Each objFile in objFolder.Files
Set objTextStream = objFSO.OpenTextFile(objFile.Path,1)
[ô]Read the file[ô]s contents into avariable
strFileContents = objTextStream.ReadAll
[ô]if the search string is in the file, then write a link to the file
If InStr(1, strFileContents, strSearchText, 1) then
Response.Write([Ô]<Table Border=[Ô][Ô]0[Ô][Ô] Cellpadding=[Ô][Ô]0[Ô][Ô] Cellspacing=[Ô][Ô]1[Ô][Ô] Align=[Ô][Ô]Center[Ô][Ô] BorderColor=[Ô][Ô]#000000[Ô][Ô] Background=[Ô][Ô][Ô][Ô] Width=[Ô][Ô]100%[Ô][Ô]> [Ô]) & vbcrlf
Response.Write([Ô] <TR>[Ô]) & vbcrlf
Response.Write [Ô] <TD Width=[Ô][Ô]50%[Ô][Ô] BGCOLOR=[Ô][Ô][Ô] & Coloralt & [Ô][Ô][Ô]><Font Face=[Ô][Ô]Arial[Ô][Ô] Color=[Ô][Ô]#000000[Ô][Ô]><A HREF=[Ô][Ô]file://[Ô] & objFile.Path & [Ô][Ô][Ô]>[Ô] & objFile.Name & [Ô]</A></TD><TD Width=[Ô][Ô]16%[Ô][Ô] BGCOLOR=[Ô][Ô][Ô] & Coloralt & [Ô][Ô][Ô]><Font Face=[Ô][Ô]Arial[Ô][Ô] Color=[Ô][Ô]#000000[Ô][Ô]>[Ô] & objFile.datecreated & [Ô]</TD><TD Width=[Ô][Ô]16%[Ô][Ô] BGCOLOR=[Ô][Ô][Ô] & Coloralt & [Ô][Ô][Ô]><Font Face=[Ô][Ô]Arial[Ô][Ô] Color=[Ô][Ô]#000000[Ô][Ô]>[Ô] & objFile.DateLastModified & [Ô]</TD><TD Width=[Ô][Ô]16%[Ô][Ô] BGCOLOR=[Ô][Ô][Ô] & Coloralt & [Ô][Ô][Ô]><Font Face=[Ô][Ô]Arial[Ô][Ô] Color=[Ô][Ô]#000000[Ô][Ô]>[Ô] & formatnumber(objFile.size,0) & [Ô]kb[Ô] & [Ô]</TD>[Ô] & vbcrlf
Response.Write([Ô] </TR>[Ô])& vbcrlf
Response.Write([Ô]</Table>[Ô])& vbcrlf
[ô] This bit of code makes the colors alternate
If Coloralt=[Ô]ECFDFF[Ô] Then
Coloralt=[Ô]CEE7FF[Ô] [ô]This belongs to the alternative Colores
Else [ô]This belongs to the alternative Colores
Coloralt=[Ô]ECFDFF[Ô] [ô]This belongs to the alternative Colores
End If
bolFileFound = True
session([Ô]intMatch[Ô]) = session([Ô]intMatch[Ô]) + 1
End If
objTextStream.Close
Next
[ô]Here[ô]s the recursion part - for each subfolder in this directory, we run the
[ô]Search function again
For Each objSubFolder in objFolder.SubFolders
Search objSubFolder
Next
[ô] We close our Objects so that we do not make the server work too hard
Set fso = Nothing
Set objFSO = Nothing
Set objFolder = Nothing
Set objTextStream = Nothing
End Function
If session([Ô]intMatch[Ô]) = 0 Then
Response.Write([Ô]<Center><b>Nenhum resultado encontrado para sua busca...</b></Center>[Ô])
End If
End If
End If
%>
Me ajudem por favor.....
Grato a todos.......
Caso encontre o arquivo, ele me retorna o nome com o link para o download.
Até ai, está tudo bem.
Porém, quando clico no link, nada acontence.
Eu preciso que o usuáio baixe esse arquivo, mas ao clicar no link que aparece, nada ocorre, nem abre o link, e nem abre a acaixa de download..
Segue o código.
<%@ Language=[Ô]VbScript[Ô]%>
<HTML>
<HEAD>
<TITLE>.:: NPA - Sintetizando o Futuro - Farmacêutica, Alimentos, Cosmética, Agrícola, Pesquisa e Desenvolvimento. ::.</TITLE>
<style type=[Ô]text/css[Ô]>
<!--
.style1 {color: #0000FF}
-->
</style>
</HEAD>
<BODY bgColor=[Ô]#FFFFFF[Ô] Background=[Ô][Ô]>
<%
Dim Coloralt [ô] We define the color variable
If Request.Querystring([Ô]results[Ô]) = [Ô][Ô] Then
%>
<Center>
<H1 class=[Ô]style1[Ô]>Sistema para Download de NFe </H1>
<table width=[Ô]787[Ô] border=[Ô]1[Ô]>
<tr>
<td height=[Ô]72[Ô]><div align=[Ô]center[Ô]><img src=[Ô]images/codbarra.jpg[Ô] alt=[Ô]Codigo de Barras NPA[Ô] width=[Ô]385[Ô] height=[Ô]128[Ô]></div></td>
</tr>
<tr>
<td height=[Ô]28[Ô]><form action=[Ô]Busca.asp?results=results[Ô] target=[Ô]main_view[Ô] method=[Ô]post[Ô] name=[Ô]DaForm[Ô] >
<input type=[Ô]text[Ô] size=[Ô]80[Ô] name=[Ô]Criteria[Ô]>
<input type=[Ô]submit[Ô] name=[Ô]B1[Ô] class=[Ô]buttons[Ô] value=[Ô]Procurar[Ô]>
<input type=[Ô]reset[Ô] name=[Ô]B2[Ô] class=[Ô]buttons[Ô] value=[Ô]Limpar[Ô]>
</form></td>
</tr>
</table>
</Center>
<Table Border=[Ô]1[Ô] Cellpadding=[Ô]0[Ô] Cellspacing=[Ô]0[Ô] Width=[Ô]100%[Ô]>
<TR align=[Ô]Center[Ô] bgcolor=[Ô]silver[Ô]>
<TD Width=[Ô]50%[Ô]><Font Face=[Ô]Arial[Ô] Color=[Ô]#000000[Ô]>Número NFe </Font></TD>
<TD Width=[Ô]16%[Ô]><Font Face=[Ô]Arial[Ô] Color=[Ô]#000000[Ô]>Data da Emissão </Font></TD>
<TD Width=[Ô]16%[Ô]><Font Face=[Ô]Arial[Ô] Color=[Ô]#000000[Ô]>Última Modificação</Font></TD>
<TD Width=[Ô]16%[Ô]><Font Face=[Ô]Arial[Ô] Color=[Ô]#000000[Ô]>Tamanho</Font></TD>
</TR>
</TABLE>
<!-- The IFRAME Starts here -->
<IFRAME name=[Ô]main_view[Ô] src=[Ô][Ô] width=[Ô]100%[Ô] height=[Ô]300[Ô] marginwidth=[Ô]0[Ô] marginheight=[Ô]0[Ô]></IFRAME>
<!-- The IFRAME ends here -->
<%
Else
[ô] We start the if statement that checks if there is a criteria...
If Request.Form([Ô]Criteria[Ô]) = [Ô][Ô] Then
Response.Write([Ô]<H2 align=[Ô][Ô]center[Ô][Ô]>é preciso informar a chave de acesso !</H2>[Ô])
Else
Dim objFolder
Dim strSearchText
Dim objFSO
strSearchText = Request.Form([Ô]Criteria[Ô])
[ô] We Create the FSO and Folder objects
Set fso = Server.CreateObject([Ô]Scripting.FileSystemObject[Ô])
Set objFSO = Server.CreateObject([Ô]Scripting.FileSystemObject[Ô])
[ô] We define the Folder to Search
Set objFolder = objFSO.GetFolder([Ô]E:\home
pa3\Web\file[Ô])
Search objFolder
Function Search(ByVal objFolder)
Dim objSubFolder
session([Ô]intMatch[Ô]) = 0
[ô]Loop through every file in the current folder
For Each objFile in objFolder.Files
Set objTextStream = objFSO.OpenTextFile(objFile.Path,1)
[ô]Read the file[ô]s contents into avariable
strFileContents = objTextStream.ReadAll
[ô]if the search string is in the file, then write a link to the file
If InStr(1, strFileContents, strSearchText, 1) then
Response.Write([Ô]<Table Border=[Ô][Ô]0[Ô][Ô] Cellpadding=[Ô][Ô]0[Ô][Ô] Cellspacing=[Ô][Ô]1[Ô][Ô] Align=[Ô][Ô]Center[Ô][Ô] BorderColor=[Ô][Ô]#000000[Ô][Ô] Background=[Ô][Ô][Ô][Ô] Width=[Ô][Ô]100%[Ô][Ô]> [Ô]) & vbcrlf
Response.Write([Ô] <TR>[Ô]) & vbcrlf
Response.Write [Ô] <TD Width=[Ô][Ô]50%[Ô][Ô] BGCOLOR=[Ô][Ô][Ô] & Coloralt & [Ô][Ô][Ô]><Font Face=[Ô][Ô]Arial[Ô][Ô] Color=[Ô][Ô]#000000[Ô][Ô]><A HREF=[Ô][Ô]file://[Ô] & objFile.Path & [Ô][Ô][Ô]>[Ô] & objFile.Name & [Ô]</A></TD><TD Width=[Ô][Ô]16%[Ô][Ô] BGCOLOR=[Ô][Ô][Ô] & Coloralt & [Ô][Ô][Ô]><Font Face=[Ô][Ô]Arial[Ô][Ô] Color=[Ô][Ô]#000000[Ô][Ô]>[Ô] & objFile.datecreated & [Ô]</TD><TD Width=[Ô][Ô]16%[Ô][Ô] BGCOLOR=[Ô][Ô][Ô] & Coloralt & [Ô][Ô][Ô]><Font Face=[Ô][Ô]Arial[Ô][Ô] Color=[Ô][Ô]#000000[Ô][Ô]>[Ô] & objFile.DateLastModified & [Ô]</TD><TD Width=[Ô][Ô]16%[Ô][Ô] BGCOLOR=[Ô][Ô][Ô] & Coloralt & [Ô][Ô][Ô]><Font Face=[Ô][Ô]Arial[Ô][Ô] Color=[Ô][Ô]#000000[Ô][Ô]>[Ô] & formatnumber(objFile.size,0) & [Ô]kb[Ô] & [Ô]</TD>[Ô] & vbcrlf
Response.Write([Ô] </TR>[Ô])& vbcrlf
Response.Write([Ô]</Table>[Ô])& vbcrlf
[ô] This bit of code makes the colors alternate
If Coloralt=[Ô]ECFDFF[Ô] Then
Coloralt=[Ô]CEE7FF[Ô] [ô]This belongs to the alternative Colores
Else [ô]This belongs to the alternative Colores
Coloralt=[Ô]ECFDFF[Ô] [ô]This belongs to the alternative Colores
End If
bolFileFound = True
session([Ô]intMatch[Ô]) = session([Ô]intMatch[Ô]) + 1
End If
objTextStream.Close
Next
[ô]Here[ô]s the recursion part - for each subfolder in this directory, we run the
[ô]Search function again
For Each objSubFolder in objFolder.SubFolders
Search objSubFolder
Next
[ô] We close our Objects so that we do not make the server work too hard
Set fso = Nothing
Set objFSO = Nothing
Set objFolder = Nothing
Set objTextStream = Nothing
End Function
If session([Ô]intMatch[Ô]) = 0 Then
Response.Write([Ô]<Center><b>Nenhum resultado encontrado para sua busca...</b></Center>[Ô])
End If
End If
End If
%>
Me ajudem por favor.....
Grato a todos.......
Olá Junior ,
O linkagem esta nessa parte <A HREF=[Ô][Ô]file://[Ô] & objFile.Path & [Ô][Ô][Ô]>
vc pode substituir esse comando , por comando javascript pra fazer o link de downloads
teste fazer um novo formulario , para testar se realmente o Scripting.FileSystemObject esta funcionando com o objFile.Path
O linkagem esta nessa parte <A HREF=[Ô][Ô]file://[Ô] & objFile.Path & [Ô][Ô][Ô]>
vc pode substituir esse comando , por comando javascript pra fazer o link de downloads
teste fazer um novo formulario , para testar se realmente o Scripting.FileSystemObject esta funcionando com o objFile.Path
Qual seria o comando em Javascript?
Araços...
Araços...
Função Java Script:
[txt-color=#e80000]<script type=[Ô]text/javascipt[Ô]>
function startDownload()
{
var url=[ô]http://server/folder/file.ext[ô];
window.open(url,[ô]Download[ô]);
}
</script>
[/txt-color]
No HREF...
[txt-color=#e80000]setTimeout([Ô]startDownload()[Ô],5000);[/txt-color] [txt-color=#007100]//starts download after 5 seconds[/txt-color]
[txt-color=#e80000]<script type=[Ô]text/javascipt[Ô]>
function startDownload()
{
var url=[ô]http://server/folder/file.ext[ô];
window.open(url,[ô]Download[ô]);
}
</script>
[/txt-color]
No HREF...
[txt-color=#e80000]setTimeout([Ô]startDownload()[Ô],5000);[/txt-color] [txt-color=#007100]//starts download after 5 seconds[/txt-color]
Tópico encerrado , respostas não são mais permitidas