Hello,
I am using an ASP that uses a third party active-x control to upload a
file to a file server using the ADO Stream Object. It uses the
FileSystemObject to create folders and files, which works fine. If the
file does not exist, it saves the file (Word.doc), if it does exists,
it checks to see if the file is open. If it is open, and another user
is trying to save or overwrite the same file, I trap an Error 3002
(document open), which another application picks up and throws an
exception. If it is open, and another user is trying to save or
overwrite this file, but no one has it open, it is not overwriting. I
realized that what is happening is if the file is created the first
time, I do a saveToFile, which works fine, and if the file is opened
and the Error 3002 is trapped, it does a loadFromFile and behaves
correctly as well. However, what is happening is if the file exists
but is not open, it is still doing a loadFromFile, and the bytearray I
am returning from the BinaryStream is only returning the file name,
corrupting the word document. So, I tried creating a separate
BinaryStream and did a copyTo a fresh BinaryStream - didn't work, then
just a separate BinaryStream which almost works - I am getting the
file to be saved and overwritten, but when I open the file it is rtf
code. I tried several methods to encode it properly, but nothing I try
seems to work. If I could figure out how to convert this second
BinaryStream to a Word doc my problem would be solved. Is there any
way to force a conversion of a bytearray returned from a Binary Stream
to a Word doc? I tried doing a "Write" and "WriteToText" and that
doesn't seem to work, and tried it with these constants: adTypeBinary
1, adTypeText 2. If I can just get the file to convert to a Word.doc
I'd have it. Any help would be appreciated.
Thanks in advance,
BZ