Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - stream/downloading files names not in Eng
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

stream/downloading files names not in Eng

 Post Reply Post Reply
Author
snooper View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 23 April 2002
Location: Israel
Status: Offline
Points: 333
Post Options Post Options   Thanks (0) Thanks(0)   Quote snooper Quote  Post ReplyReply Direct Link To This Post Topic: stream/downloading files names not in Eng
    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: 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
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
snooper View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 23 April 2002
Location: Israel
Status: Offline
Points: 333
Post Options Post Options   Thanks (0) Thanks(0)   Quote snooper Quote  Post ReplyReply Direct Link To This Post 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!

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 14 June 2004 at 12:12pm
if you get a 404 when entering the full url, then it's not your script 
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
snooper View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 23 April 2002
Location: Israel
Status: Offline
Points: 333
Post Options Post Options   Thanks (0) Thanks(0)   Quote snooper Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
snooper View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 23 April 2002
Location: Israel
Status: Offline
Points: 333
Post Options Post Options   Thanks (0) Thanks(0)   Quote snooper Quote  Post ReplyReply Direct Link To This Post 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!

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.