PDF is blank after Upload from ASP Classic -


i making uploader page have use asp classic , found jacob "beezle" gilley's uploader , working, long txt file. problem occurs when it's pdf file or image, , need upload them.

the problem example pdf file gets uploaded place blank. have edited in of original code since need have utf-8 encoded. otherwise identical, , upload edited code.

    public sub savetodisk(spath)     dim ofs, ofile     dim ostream      if spath = "" or filename = "" exit sub     if mid(spath, len(spath)) <> "\" spath = spath & "\"      set ofs = server.createobject("scripting.filesystemobject")     if not ofs.folderexists(spath) exit sub      set ostream = createobject("adodb.stream")     ostream     .type = 2     .charset = "utf-8"     .mode = 3     .open     .writetext rsbinarytostring(filedata)     .savetofile spath & filename     .close     end     set ostream = nothing end sub 

how fix it, or can fix it? rsbinarytostring method credited antonin foller, http://www.motobit.com found convert utf-8. whitout cant open files.

i found out answer question.

    public sub savetodisk(spath)     dim ofs, ofile     dim ostream     dim strtext      if spath = "" or filename = "" exit sub     if mid(spath, len(spath)) <> "\" spath = spath & "\"      set ofs = server.createobject("scripting.filesystemobject")     if not ofs.folderexists(spath) exit sub      set ostream = createobject("adodb.stream")     ostream     .type = 2     .charset = "windows-1252"     .mode = 3     .open     .position = 0     .seteos     .writetext rsbinarytostring(filedata), 0     .savetofile spath & filename, 2     .close     end     set ostream = nothing end sub 

instead of using charset = utf-8 use windows-1252. works charm.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -