I use the Stream method to serve certain file types to the user. If the
type is pdf, it opens in the browser fine. My problem is with those
that the browser doesn't have plug-ins such as ppt, word, etc. it
prompts to choose Open/Save/Cancel and defaults the filename to the ASP
page serving the content. ie. BinarySend.asp -> BinarySend.doc,
BinarySend.ppt.
If I use
Response.AddHeader "content-disposition", "attachment;filename=" &
sFileName then it defaults the filename to the name I specify but
always prompt a download instead of opening directly.
Is there another way to default the filename in situation like this?
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?
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.
I have an asp page that produces output from a database. This allows a simple way for the user to save the data to a text file by going to File->Save as...
The default save as options always defaults to a particular filename and the save as type is always html, therefore the user has to manually type a filename and choose Text File (*.txt) as the type.
I remember I was able to overide ride these options with the following code.
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"....
I'm trying to create a page that uploads a file. I get an error message saying ADODB object Stream is not available in my server. How do I upgrade my ADODB library?.
I'm running win 2000, I downloaded a calender and put it into my root website folder. the calendar folder contained a file called adovbs.inc . After the insertion of this folder and creating links to it we noticed that when the web page loaded it's home page, another older page that has been deleted is displayed.
This page was located in the calendar folder. So now I've deleted the calendar folder, and restarted the server but this old page is still on display.
I am using the code below to ensure that a download will be sent to the user as a save/open dialog box and not open up in the browser. However I get one of a few different issues.
1. Sometimes the when you click save the box just dissapears and you never get to choose where to save it. And then don't get the file!
2. If you get past the first problem (seems to be unique to pdf's) and can select where you want to save the file, it then doens't actually download the file and the box just dissapears again!
3. If you get past both of these, documents are often corrupt!
Any idea what could be causing these? The server has MDAC 2.8 installed, and it works slightly better on our local testing server Win2k than it does on the live Win2k server! All very odd! Code:
I`m writing a little routine that captures the data from a form submit (ie a picture) and then at the back end the asp will saved it back out into a file on the server.
I can capture the file fine and display the binary data to the screen.. but now I`m trying to write the data back into a file on the server. After a bit of searching around on the net I found that most people where suggesting using the ADODB.Stream functions.
So this is what I've got but for some reason when I go to write the binary variable it complains. Code:
I have an ASP page that downloads file with the ADODB.Stream object. I've found that if the user click cancel in the "Save file as" window or during the downloading, the download is no more available, the page hangs over and and the session have to be closed. (In some cases you have to Cancel more than one time the download process to rise up this error).
I've experienced this problem, as a user, with many major webmail services too!
I have an asp page that needs to display the string that is returned from a cgi file.
As an example, if you enter http://mydomain.com/mycgi.cgi?98127398 in to a browser, it will display YES or NO
I need to have my asp code query this url, get the resulting string, then act upon it (basically use the answer to display a nice big tick or a big cross). Code:
It involves using ASP/VbScript and ADODB.Stream to read binary data from a *.DOC or *.RTF file and then send it to the user with Response.ContentType and BinaryWrite.
Everything works fine until I try to Replace() certain strings in the *.RTF file with my own data. I'm assuming Replace() is choking on the binary characters, or incorrectly thinking 0x00 values are marking end of string. Code:
I use the code below to authorise the download of certain files. Thus, instead of linking to the file in a wwwroot directory, I link to this code with the filename as a parameter, and the script streams the file if the user is authorised.
This has worked fine on PDFs, DOCs, XLS, etc. until today, and 18MB file presents the error message 'format error: not a pdf or corrupt'.
Is there a file size limit, or a default that needs overridden? Any thoughts? Code:
ADODB.Recordset (0x800A0BB9) Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
I'm trying to populate a form based on records determined by the selection made from a drop down box. The drop down is populated fine, but the same methods seems unable to work for the rest of the form and I receive the above error message.
I'm trying to connect a dbase but an error appear. This is the error type:
"ADODB.Recordset(0x800A0BB9) arguments are of the wrong type are out of acceptable range or are in conflict"
I used the code for example:
rs.Open "SELECT * FROM table1", db, adOpenStatic, adLockPessimistic
The microsoft ASP documentation says that adOpenStatic, adLockPessimistic, equals to 3,3 notation. I used first the code above then the error appears. But when I change it to 3,3 it runs ok.
when I submit I get the error message "File not found"
So a did a respnse write to write my filename and found it is now called 2006_Apr_19-83955.23.bin It seems to be the time as it changes each time I try and get the filename to write...
this is the code on my delete page
<% Dim Upload Dim FileName Dim Folder Set Upload = New clsUpload FileName = Upload("File1").FileName response.write "Here is the file " & FileName & " name <br>"
Folder = Server.MapPath("..country") & "" & strPathToSave response.write "Here is the folder " & folder & " name"
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.
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.
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
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.
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?
I'm looking for a way to check if a directory has any filenames with 'w9' in it, and if so print 'yes' in the appropriate place. My database has a field called CustomFieldFilesDir where the appropriate folder structure is already entered for each person ex. 'p:john doe'. I've searched and found scripts that look at extensions but not the file names themselves.
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:
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?
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
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.