Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · ASP.NET Newsletter Application · Web Hosting Plans · Faisal Khan's Blog · Contact
Forums : ASP : ASP 3.0 : Not able to read contents from file. Signup · Login
Author Thread
Not able to read contents from file.
Posted in tutorial: Working with Drives, Folders and Files in ASP
·  deepay2k
User
Joined: 5 Jul 2004
Total Posts: 2

Not able to read contents from file.

Posted: 5 Jul 2004
I have uploaded the file and while trying to read it only blank application is opening. eg:- If it is text file only the note pad is opened and there are no contents in it. Again while opening it asks "open with" what.
Please help me the code used is.
<%
On Error Resume Next
If Not Response.isClientConnected Then
Response.end
End If
Response.buffer = true
'"images/AspBinFile.gif"
mFile = request("file")
mFile="images/"& mFile
Response.contenttype = "image/gif"
'Response.ContentType = ContentType
Response.AddHeader "content-disposition","attachment;filename=" & mFile
Dim objBinFile, objFSO, objFile
Dim mFile, mMapFile

' Custom server component
Set objBinFile = Server.CreateObject("ASPBinFile.clsASPBinFile")

' FSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

mMapFile = Server.MapPath(mFile)
IF objFSO.FileExists(mMapFile) = False Then
Response.End
Set objFSO = Nothing
Set objBinFile = Nothing
End If
Set objFile = objFSO.GetFile(mMapFile)
mStream = objBinFile.BinFileRead(mMapFile)
Response.BinaryWrite mStream
Set objFSO = Nothing
Set objBinFile = Nothing
Response.End
%>

Deepa S
Want to leave a comment? Login or Register for free!

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

Login to post a comment or start a new thread
UserName Or Email Address:       Password:       Auto-Login:    
· Create New User Account
· Send Forgotten Password by Email
 
© 1999 - 2010 Stardeveloper.com, All Rights Reserved.