Classic asp code to download a file






















Do you need your password? Submit your solution! When answering a question please: Read the question carefully. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.

If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid. Improve this question. Would check your server configuration hasn't changed. Has there been an upgrade etc? The value you want to check is AspMaxRequestEntityAllowed which will default to KB so this might explain why some work and others don't, anything over KB by default will fail.

How to config this depends on what version of IIS you are running. Add a comment. Active Oldest Votes. With Server. IsClientConnected And. Read intChunkSize Loop. Close End With. Improve this answer. Bond Bond Sign up or log in Sign up using Google. When answering a question please: Read the question carefully. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem.

Insults are not welcome. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid. Related Questions. Attaching files with email in classic ASP. I changed the script and insert a path. This way I do not show the real path to my visitor. Hi, I am trying to download a. I have a scenario where i have to provide the download count of a file, in that case if the User cancel the download, those i should not consider.

The desired effect There are times when you want users to download a file instead of opening it up in a browser; like images, text files, ASP code files, MS Office files like Powerpoint or Word files, etc. We want the user to receive a prompt though, asking them if they want to save or open the file, like below: We can achieve the above for any file, by simply editing the Response that the browser receives from our web server.

Write "No file specified. Write "Illegal folder location. Write "Folder path too long. CreateObject "Scripting. GetFile strAbsFile '-- first clear the response, and then set the appropriate headers Response. Clear '-- the filename you give it will be the one that is shown ' to the users by default when they save Response. Name Response. AddHeader "Content-Length", objFile. Stream" objStream. Open '-- set as binary objStream.

BinaryWrite objStream. Read objStream. FileExists strAbsFile Response. Write "No such file exists. Phillipe Calmet Williams October 29, End ————- Thank you for the useful code. Evagoras Charalambous October 29, Phillipe Calmet Williams: Absolutely.

And feel free to use this in any way you find it useful. I am just glad I could help. Salih November 26, Evagoras Charalambous November 28, Stephane Demers November 28, Stephane Demers Interesting idea.

What do you think? Thanks , Shiroj. Evagoras Charalambous February 2, Evagoras Charalambous February 5, Evagoras Charalambous February 6, Hi, I am not sure exactly how to pass the parameter via the url.

Evagoras Charalambous February 8, Evagoras Charalambous February 10, Bob February 20, Evagoras Charalambous February 20, Clear: Response. Evagoras Charalambous February 22, Greg February 22, I think you can remove line 54 above which reads: Response.

Read and replace it with something like this: Do While Not objStream. Flush Loop That should break up your file in chunks of bytes and avoid running into the 4GB limitation.

Evagoras Charalambous March 2, GarryBrown March 11,



0コメント

  • 1000 / 1000