Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · Web Hosting Plans · Faisal Khan's Blog · Contact
Forums : ASP : ADO/ODBC : Posting other Binary data problems Signup · Login
Author Thread
Posting other Binary data problems
Posted in tutorial: Uploading Files into an Access Database using plain ASP
·  rsousae
User
Joined: 18 May 2004
Total Posts: 3
Posting other Binary data problems
Posted: 18 May 2004
I've been using this script to insert all different files types with great success! The only files that seem to give me grief are Lotus files (*.wk4). The files upload okay, but when I click on a link to view them it tries to open file.asp? When looking at the uploaded file in the database it displays Content Type as
application/octet-stream rather than a Lotus type. Is this an issue with the loader.asp functions or something on the server side?

Any help in this matter would be most appreciated!
Thanks, Ron.
·  Faisal Khan
AdminAdminAdminAdmin
Joined: 24 Sep 2002
Total Posts: 547
Re: Posting other Binary data problems
Posted: 18 May 2004
Well the server-side doesn't know what content-type the file has, it takes and believes whatever the *client-side* tells it at the time when the client browser sends the file.

In the ASP.NET uploading tutorials I used a cool technique where the ASP.NET code on the server-side uses the Windows registry to fetch the correct content-type for a file with a known extension e.g. .doc. But obviously that technique hasn't been used in the ASP version of the article.

Another option for your file.asp is to check the file extension when it fetches it from the database and set it to whatever is the *correct* (I don't know what is the correct content-type for .wk4) content-type and then send it to the client browser. Obviously it'll mean that you'll have to make some editions to the code *yourself*. :)

Faisal Khan.
Stardeveloper.com
·  rsousae
User
Joined: 18 May 2004
Total Posts: 3
FYI: The problem stems from Lotus...
Posted: 19 May 2004
After much research, I have found that the problem stems from the set MIME type for Lotus 123 or lack there of. Lotus for some reason does not set this up by default at installation time. If the client doesn't manually set the MIME type for Lotus 123 to 'application/vnd.lotus-1-2-3' it will not work. This is also noted as a problem on the Lotus support site, with status of: "currently no work around"

So even when I set file.asp to change the contentType to 'application/vnd.lotus-1-2-3' prior to the binarywrite command it still won't work if the client hasn't setup the MIME type.

Any other ideas? =)
·  Cverma
User
Joined: 24 Sep 2004
Total Posts: 1
Posting excel/word makes the contenttype to application/octet-stream
Posted: 24 Sep 2004
I have 4 webservers where the uploading of the file works absolutely fine. But on the 5th server which is accessed using https://applicationame, when I upload the excel/word files, the content type gets converted to application/octet-stream instead of "application/vnd.ms-excel". But on rest of the servers that are accessed using http://applicationanme, the files get uploaded with right contenttype.

So while downloading the above files, tha application tries to download it as filename.xls.aspx

I am similar problem as Ron does. Any help would be appreciatde.

Thanks,
Chanda.
·  Tins30
User
Joined: 1 Aug 2007
Total Posts: 3
The problem stems from Lotus...
Posted: 1 Aug 2007
I had similar prob. This is what I did to fix it whenever it came up with application/octet-stream data type. Hope it works for you..: Let me know..

rsImage("MIMEType").Value = trim(Mid(fileName, instr(1, fileName, "."), len(filename))) 'contentType

instead of

rsImage("MIMEType").Value = contentType

Whatever file you select will always have default extension and this will grab that extension. But you have to make sure your file does not have more than 1 dot("."). In that case you can do reverse string and seek first "." it finds.

See if this works! It worked for me.

Users Who Have Visited This Thread In Last 24 Hours
7 Visitors

Login
UserName Or Email Address:       Password:       Auto-Login:    
· Create New User Account
· Send Forgotten Password by Email
 
© 1999 - 2009 Stardeveloper.com, All Rights Reserved.