How To Save Byte Stream As Binary Document
A site Im working with has an API that allows one to retrieve files.
The file is a Word doc sent as a byte stream.
url="blah.asp?fileid=777777"
set oXMLHTTP=server.CreateObject("MSXML2.ServerXMLHTTP.4.0")
oXMLHTTP.open "POST",url,false
oXMLHTTP.send
binData=oXMLHTTP.responseText
I am trying to save the stream as a file on the Web server. It isn't
working. I've tried using FS.OpenTextFile, Stream.Write, etc.
Nothing is working.
Anyone have any sample code on how to do this?
View Replies
ADVERTISEMENT
I wanna read binary data from database with ADODB.Stream object. So I wrote code..
---------
<%
query = "SELECT * FROM Categories"
adoDB.DefaultDatabase = "Northwind"
adoRs.Open query, adoDB, 1
Set rec = Server.CreateObject("ADODB.Record")
'read [Picture] column.
rec = adoRs(3)
------------
And the 'rec' TypeName() is 'Byte()'
But I can't get it to ADODB.Stream. How Can I do? Or Can I read binary column to another way?
View Replies
View Related
In the Sql server 2000 I store some word documents.Then I get the data from the database
through the asp code and display the word document in IE.The ContentType is "application/msword". how to save the word document which is edited to the database.
View Replies
View Related
I read in an XML document, change an attribute here or there, now I want to save the new version back to disk,
View Replies
View Related
I've an ASP.Net c# application that needs to read Word documents from a directory on the web server, open them in Word from the client browser, edit the content and then update the document on the server.
I can almost do it by pasting the url into the "Save As" location but I get a "read only" message when I try to save.I'm happy to code httpRequest objects or Word automation,if necessary, but I need to resulting procedure to be intuitive for the user.
View Replies
View Related
I have gotta a page in which a user can upload his profile (saved in word format). Is there any way that this profile can be stored into the database and not in the web directory. I tried using Scripting.Dictionary.
View Replies
View Related
I get a TYPE MISMATCH complaint fm ASP when I do the following in
trying to extract the high-order four bits. The complaint being that the
strTemp value is a string. Well, yes - it's a 1-char string.
NumTemp = MidB(strTemp,1, 1) And &Hf0
What am I doing wrong? (Something dumb, I'm sure, but ... .)
View Replies
View Related
I am now going a step further in asp trying to understand how asp browser upload scripts work. Looking at a couple of browser upload script, I unfortunatly constated that I really don't know nothing about "bytes". This is an obscure area to me. I consider bytes only a measure unit.
What are exactly bytes? If there is no way for visualizing them, then what can they be compared to? numeric values? any good article about this?
View Replies
View Related
I have a byte array containing the data of an image file (for example gif) in my asp code. How can I display it on the website? No image file exists on the disk. Is it possible to update a div field? What should I put there?
Please tell me there is another solution than writing the image to a file and then load it into the page, it's a real time application and speed is very important here.
View Replies
View Related
I am getting byte array from COM to ASP page like this, This array is having DOCUMENT Image from Database.
set objData = CreateObject("MemoService.FileAttachement")
bRet = objData.GetAttachedDocument(strClipID)
Here, bRet contains byte array. When I try to open that document using
response.BinaryWrite bRet
I am not able to open the file in the browser. It is writing only the file name (for ex. c: emp.doc)
View Replies
View Related
I need access to the bits of a Byte expression and the logical functions operatge bit-wise on numeric vales - per the VBScript CHM.
So how do I convert a Byte to its numeric value?
View Replies
View Related
How do I do that? This is for some bit-diddling, but the logical functions like AND require numeric expressions, per the book.
View Replies
View Related
I am trying to use ServerXMLHTTP to post data containing Japanese
characters, but the data posts as question marks, boxes or just random ascii
characters. Here is the code I am using:
View Replies
View Related
I want to convert the binary data to string. I tried doing the same using following peace of code.
Function SimpleBinaryToString(Binary)
Dim I, S
For I = 1 To LenB(Binary)
S = S & Chr(AscB(MidB(Binary, I, 1)))
Next
SimpleBinaryToString = S
End Function
It works fine when the data is English. But when the binary data contains some Japanese characters the resultant string gets corrupted.
View Replies
View Related
In dreamweaver using javascript I've developed a page that sends the form's contents via Jmail to the user. It works fine until i try to send double byte characters(i.e. japanese). It sends the email but once i open it up in a mail client the text is illegible. My mail server and mail client never has problems sending and recieving double byte characters, the only time this problem pops up is when i send an email from an ASP page via Jmail. I've tried sending the email in plain text and html but it hasn't made any difference. Here is the code I've been using: .....
View Replies
View Related
I moved ASP WebPages from Windows 2000 server to Windows 2003 server platform. Those double-byte characters (Japanese) retrieved from SQL server 2000 are corrupted.
I am using Macromedia Dreamweaver MX as the development tool, by encoding webpage as "UTF-8" as the following, <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
I also add
<%
Response.CodePage = "65001"
Response.Charset="utf-8"
%>
into my ASP page. But it does not solve the problem.
My ASP pages are working perfectly in Windows 2000 server, but they are not working on Windows 2003 server (Web edition & Enterprise Edition).
Is there anyone encountered the similar problems before ? I research the Microsoft website, no any answers on that.
View Replies
View Related
I am near to desperation as I have a million things to get a solution
for my problem. I have to post a multipart message to a url that
consists of a xml file and an binary file (pdf). Seperately the
posting words fine but when I want to create one multipart message
with both then things go wrong.
The binary file is converted and of datatype byte()
The xml file is just a string.
I don't know how to merge these two into the multipart message. I have
tried converting the binary to string and then concatenate but that
doesn't work as it seems to leave off the last part of the file and
the boundary.
View Replies
View Related
I'm using Msxml2.ServerXMLHTTP.3.0 to fetch a HTML page on a remote
server. The fetched page is then parsed and the information of interest
is extracted and send to the client browser.
However, the remote server does not specify any character coding in its
headers. If using ResponseText property in ServerXMLHTTP, some
international characters are not decoded correctly. This is due to
ResponseText assuming UTF-8 coding if no character set is specified.
My solution is to use the ResponseBody property which returns the web
page as an array of unsigned bytes. I then convert the data to a string
using the ADODB.Stream method as described here:
http://www.motobit.com/tips/detpg_binarytostring/
The string is then parsed and the required information is pulled out.
This solution works just fine but I wonder if there is some more
efficient (without the need for a byte to string converion) way to
solve the problem.
View Replies
View Related
I have a page which streams an Excel spreadsheet to the user. It has worked
fine for 12mths or more, but recently I found out that it wasn't working. I
suspect the problem lies with IIS, but I'm not sure...
When the user submits a form, the page should stream the file to the user -
the user is presented with a standard Open/Save/Cancel dialog, which the
would ordinarily save to their HDD. I have updoaded the code from the live
server to my development machine (IIS5.1) - and this same code works fine.
However, on the live server (IIS6), the user is presented with the dialog
box, but rather than listing myfile.xls, it lists mypage.asp as the file to
be downloaded.I think this must be an IIS6 issue but I don't know what. Some time before
the problem was noticed, work had been done on the live server, but AFAIK
nothing was done that was *intended* to affect this application.
View Replies
View Related
I'm using streams to upload a file. I get an error 800a0bbc write to file failed.
I've looked on support.microsoft.com and groups.google.com.
No luck on what a 800a0bbc error is.
View Replies
View Related
Does anyone know how to create an attachment using a stream in classic
ASP.I can see that it can be done in ASP.Net as per the article below:
Initializes a new instance of the Attachment class with the specified
stream and name.
http://msdn2.microsoft.com/en-us/library/6sdktyws.aspx.
View Replies
View Related
After the latest security update, is it still possible to use adodb.stream
on the server side?
View Replies
View Related
I'm using
file.OpenAsTextStream(ForReading, _
TristateUseDefault)
and then i read some lines.
Line = TextStream.readline
Then when i finished reading it i need to go to the begiining and read some
lines again.But i dont see how to go back to the begining.
I mean, Is there a way to go back to the first line of the file if i
allready read some lines
View Replies
View Related
We have an application, written in ASP, that uses the ADODB.Stream to be
able to open files and write byte arrays to the Response object. If one of
our administrators patches the web servers this application runs on in
Windows Update, I'm screwed, right? You've essentially just disabled this
COM object, for not only its evil purposes, but its useful ones?
View Replies
View Related
Ok, I'm stumped on something that really shouldn't be this hard. I've
created some cool code to transform a dataset via XSLT into SpreadsheetML
(XML for Excel) and I'm storing the physical file on a file server. Now... I
currently provide a hyperlink to view/save the file, but this won't work
outside the network.
So, I've been working on making this
hyperlink/linkbutton/button/whatever stream the file back to the user. How
in the name of Zeus's butthole do I do this?
So, in simpler terms; how do I take a physical file and stream the sucker
back? Ideally, I'd like this to work just like it does now with the physical
link to the file. Click the link, it prompts you to save/open/cancel.
Clicking Open pops up Excel and looky-looky, you see the file.
View Replies
View Related
The problem is that in XP SP2, the IE instance opened for the vbscript only
page no longer closes when Excel is closed. The user has to manually close
this window. This didn't happen in XP SP1. Obviously there is a security
change, but I have been unable to determine how to reverse it.
Does anyone know how I can get the IE instance to close when Excel closes in
XP2 SP2?
View Replies
View Related
I am using ADODB.Stream for downloading the files on user machine. The code works fine when filesize is less than 10 MB. But if file size is more than 10 MB then it doesn;t get download. Can anyone tell what is the problem. I have to user some different component.
View Replies
View Related
I'm looking to have an image (say, icons for a particular document) and when it is clicked on, I would like the "Open/Save/Cancel" dialogue to open up.
I was told using an ADO data stream was the way to go, making the app an unknown so the dialogue opens:
Dim FileName
Dim FullFileName
FileName = "MyWordDocument.doc"
FullFileName = "C:WebfilesMyWordDocument.doc"
Response.ContentType = "application/x-unknown"
Response.Addheader "Content-Disposition", "attachment; filename=" & chr(34) & FileName & chr(34)
Response.Binarywrite GetBinaryFile(FullFileName)
Function GetBinaryFile(ByVal FileSpec)
Const adTypeBinary = 1
Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open()
objStream.Type = adTypeBinary
objStream.LoadFromFile (FileSpec)
GetBinaryFile = objStream.Read()
Set objStream = Nothing
End Function
Is there a better way to do this? Also, I grab the file name from a SQL query which is then populated to a datagrid - the image name/etc is populated dynamically - how is this done in ASP? Is that with an anchor tag?
<asp:TemplateColumn ItemStyle-HorizontalAlign="Center"><ItemTemplate><asp:Image ID="thumb" runat="server" /></ItemTemplate></asp:TemplateColumn>
View Replies
View Related
i want to be able to write an asp.net function to download files.
For example, brinkster.com hosting service has a COM component that allows a stream of binary data to the client from the server so that the client will be prompted to download the file.
here is the syntax:
Set Upload = Server.CreateObject("Persits.Upload")
Dim SysFilePath
SysFilePath = Request.QueryString("filePath")
' Parmeters:
' 1. Path to file to download
' 2. Yes, build content-xxx headers
' 3. Use this value for Content-Type header
' 4. Include the word "attachment;" to Content-Disposition to force download
Upload.SendBinary "premfs3sitespremium8jaydakissx22webrootmyFile.txt, True, "application/octet-binary", True
How can I do this in asp.net without using the "Persits.Upload" COM object?
View Replies
View Related
I am trying to create a text file by using the following code. But it's not working. It just loading the page that's all.
<%
DIM fso, NewsFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set NewsFile = fso.CreateTextFile("c: est1.txt", True)
NewsFile.WriteLine("Hello World!")
NewsFile.Close
%>
View Replies
View Related
I am trying to secure .pdf files by having users login and based on UserID, allow access to certaing .pdf's.
I have tried it a few different ways using different file types and their corresponding contenttype and nothing happens. I even used the same example from microsoft.com and I get "page cannot be displayed"....
View Replies
View Related
got stalled at at point that i can no longer get my thoughts together.the point, is in classic asp, stream an excel file from a firebird database.temporarly save it if necessary,stream it to the browser,delete the temp file
on googling, i found some examples but all assuming that the file is locally present.
on the other hand, i beleive that is possible to stream the binary file and the save it locally to then present it to the browser, but i can't figure out how.
View Replies
View Related
I have a page on our intranet that is supposed to stream an Excel sheet to the user.
View Replies
View Related