Print Page | Close Window

stream/downloading files names not in Eng

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=10854
Printed Date: 31 March 2026 at 2:42pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: stream/downloading files names not in Eng
Posted By: snooper
Subject: stream/downloading files names not in Eng
Date Posted: 13 June 2004 at 6:41pm
HI all

I have a database with info on files that are stored in a folder on my site.
When you click the file ID, the file is streamed to the user.

I have noticed that when the files are not in english (in my example: hebrew), as in: hebrew_name.doc
The file does not stream properly to the user, and it seems as though the browser cannot locate the file.
In fact, even giving the full path: http://www.site.com/secretPath/hebrew_name.doc - www.site.com/secretPath/hebrew_name.doc , doesn’t work as it does with 'regular' files.

Any idea how I can do this?
I've also tried using server.HTMLencode and server.URLencode on the file name, but zilch.

Anything?
Thanks!
Kn

code follows - - - - - - - - - - - - - - - - - - - - - -
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1255" LCID = "2057" %>
<!--#include virtual="/includes/common.asp" -->
<!--#include virtual="/admn/files/config.asp"-->
<!--#include virtual="/admn/files/aspmkrfn.asp"-->
<%
strID = Request.Querystring("ID")
If strID = "" Or IsNull(strID) Then strID = Request.Form("id")
If strID = "" Or IsNull(strID) Then Response.Redirect "ChinuchDB.asp"


          Set conn = Server.CreateObject("ADODB.Connection")
          conn.Open xDb_Conn_Str
          
          strsql = "SELECT * FROM [tblFiles] WHERE [file_ID]=" & strID
          Set rs = Server.CreateObject("ADODB.Recordset")
          rs.Open strsql, conn, 1, 2
          If rs.Eof Then
               Respon se.Clear
               rs.Clo se
               Set rs = Nothing
               conn.c lose
               set conn = nothing
               Respon se.Redirect "ChinuchDB.asp"
          Else
               rs.Mov eFirst

               ' Get the field contents
               x_file _ID = rs("file_ID")
               x_file _name = rs("file_name")
               x_file _size = rs("file_size")
               x_file _orig_name = rs("file_orig_name")
               x_file _uploaded = rs("file_uploaded")
               x_file _status = rs("file_status")
               
               x_file _downloaded = rs("file_downloaded")
               
               rs("fi le_downloaded") = x_file_downloaded +1

               rs.upd ate
               rs.Clo se
               Set rs = Nothing

          End If
          
          'now find mime type:
          
          SQLmime = "SELECT * FROM tblMime WHERE extension = '" & right(x_file_name,3) & "'"
          
          set rsMime = Server.CreateObject("ADODB.Recordset")
          
          rsMime.open  SQLmime, conn
          
          if rsMime.eof then
               SQLmim e = "SELECT * FROM tblMime WHERE extension = '" & right(x_file_name,4) & "'"
               rsMime .requery
          end if
          
          strMimeType = rsMime("MimeType")
          
          rsMime.close
          set rsMime = nothing
          
          conn.close
          set conn = nothing

if x_file_status = "off" then response.Redirect("ChinuchDB.asp")

'strFileName = x_file_name      'right(x_file_name, len(x_file_name)-9)
strFileName = left(x_file_name, len(x_file_name)-4)
strOrigFileName = left(x_file_orig_name, len(x_file_orig_name)-4)
strFileExtension = right(x_file_name, 3)
intDocSize = clng(x_file_size)*1024
dtModified = cdate(x_file_uploaded)
strSecretPath = strFileUploadPath & server.URLEncode(strFileName) & "." & strFileExtension
bDownload = true 'to force the "Save As" box (IE 5.0 has bug though)

Response.ContentType = strMimeType '"application/octet-stream"
'Response.ContentType = "application/octet-stream"

' Send file name and disposition (default/inline vs. attachment)
If bDownload Then ' attachment mode to force the "Save As" box (IE 5.0 has bug though)          ***str OrigFileName
     Response.AddHeader "Content-Disposition", "attachment;filename=""" & server.URLEncode(x_file_ID)  & "." & strFileExtension & """"
Else ' let browser decide
     Response.AddHeader "Content-Disposition", "filename=""" & server.URLEncode(x_file_ID) & "." & strFileExtension & """"
End If
     
' Send modification time
Dim hh, mm, ss
hh = Hour(dtModified)
If hh < 10 Then
     hh = "0" & hh
End If
mm = Minute(dtModified)
If mm < 10 Then
     mm = "0" & mm
End If
ss = Second(dtModified)
If ss < 10 Then
     ss = "0" & ss
End If

Response.AddHeader "Last-Modified", WeekDayName(WeekDay(dtModified),True) & ", " & Day(dtModified) & " " & MonthName(Month(d



Replies:
Posted By: dpyers
Date Posted: 13 June 2004 at 7:10pm
Do you actually get a 404 error or does something else happen?

-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: snooper
Date Posted: 14 June 2004 at 2:00am

well, using this d/l file above, i get a prompt (the regular save downloaded file prompt) that asks to save the file called: "getFile.asp.asp?id=45" - or whatever the particular ID is (instead of file.doc) . then even if press save, it just gives an error "IE was not able to download this file... either it was unavailable...."  - basically a 404.

if i enter the full url to the file, i get a 404.

thanks!



Posted By: Semikolon
Date Posted: 14 June 2004 at 12:12pm
if you get a 404 when entering the full url, then it's not your script 


Posted By: dpyers
Date Posted: 14 June 2004 at 1:52pm
I'd suspect something with language settings - somewhere. Hebrew is one of those R to L languages. SFAIK, you can have language settings on the Client PC, for the Browser, in the Script, and for the server. The only suggestion I would have would be to set everything to the servers language settings and see if/hope that works. Then start making adjustments from that point.

-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: snooper
Date Posted: 14 June 2004 at 4:03pm

thanks guys. i also have a feeling its the language somewhere... cos its like having a URL thats half in English and then half (the file name , and in this case - the doc name) in hebrew, or chinese or whatever....

i was hoping there was some kind of a trick that i didnt know that someone would pull out their sleeve ;)  that would solve the issue...

thanks anyway guys



Posted By: dpyers
Date Posted: 14 June 2004 at 6:10pm
Couple of other things I'd check out after the language codes/lcid's, would be to make sure there's no spaces in the name, and see if maybe the doc file needs a mime type specified in Hebrew - I wasn't clear if the .doc stayed, or was replaced with Hebrew characters.

-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: snooper
Date Posted: 15 June 2004 at 4:14am

yeah, thanks. the name has stayed until now in Heb (but i'll be changing that now, i think!), and spaces in the names are taken care of during upload.

thanks again!




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net