473,761 Members | 9,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detect File is Completely Download by Client

RC
how to detect file is completely downloaded from client by following code?

<%@ Page language="C#" debug="true" %>
<script language="C#" runat="server">
private void Page_Load(objec t sender, System.EventArg s e) {
Response.Conten tType="applicat ion/zip";
Response.Append Header("Content-Disposition","a ttachment;
filename=myzipf ile.zip");
Response.WriteF ile(@"c:\inetpu b\wwwroot\myzip file.zip");
Response.Flush( );
}
</script>
Nov 19 '05 #1
5 3033
You can't. Once the file is sent, you have no way of knowing how long it
travels over the web, or how slow the other person's connection is, or how
long it takes. Once you send it, your job is done.

"RC" <rc@gmail.com > wrote in message
news:eX******** ******@TK2MSFTN GP09.phx.gbl...
how to detect file is completely downloaded from client by following code?

<%@ Page language="C#" debug="true" %>
<script language="C#" runat="server">
private void Page_Load(objec t sender, System.EventArg s e) {
Response.Conten tType="applicat ion/zip";
Response.Append Header("Content-Disposition","a ttachment;
filename=myzipf ile.zip");
Response.WriteF ile(@"c:\inetpu b\wwwroot\myzip file.zip");
Response.Flush( );
}
</script>

Nov 19 '05 #2
"Marina" <so*****@nospam .com> wrote in message
news:Or******** ******@TK2MSFTN GP12.phx.gbl...
You can't. Once the file is sent, you have no way of knowing how long it
travels over the web, or how slow the other person's connection is, or how
long it takes. Once you send it, your job is done.

Um, wrong, you don't just chuck a file onto the Internet and hope it reaches
it's destination. A stateful connection takes place.

There is a solution. You could send it about 512 bytes a time with
Response.Binary Write / Response.Flush and check for
Response.IsClie ntConnected between each block. If that is ever false, the
connection has dropped and the user doesn't have their file.

--
Matt
"RC" <rc@gmail.com > wrote in message
news:eX******** ******@TK2MSFTN GP09.phx.gbl...
how to detect file is completely downloaded from client by following code?
<%@ Page language="C#" debug="true" %>
<script language="C#" runat="server">
private void Page_Load(objec t sender, System.EventArg s e) {
Response.Conten tType="applicat ion/zip";
Response.Append Header("Content-Disposition","a ttachment;
filename=myzipf ile.zip");
Response.WriteF ile(@"c:\inetpu b\wwwroot\myzip file.zip");
Response.Flush( );
}
</script>


Nov 19 '05 #3
His code wasn't doing that. Presumably he wanted to know if there was a way
to check that after executing that piece of code. He's got to rewrite that
block of code first.

"Matt Dockerty" <Ps reply to group> wrote in message
news:eE******** ******@TK2MSFTN GP15.phx.gbl...
"Marina" <so*****@nospam .com> wrote in message
news:Or******** ******@TK2MSFTN GP12.phx.gbl...
You can't. Once the file is sent, you have no way of knowing how long it
travels over the web, or how slow the other person's connection is, or
how
long it takes. Once you send it, your job is done.


Um, wrong, you don't just chuck a file onto the Internet and hope it
reaches
it's destination. A stateful connection takes place.

There is a solution. You could send it about 512 bytes a time with
Response.Binary Write / Response.Flush and check for
Response.IsClie ntConnected between each block. If that is ever false, the
connection has dropped and the user doesn't have their file.

--
Matt
"RC" <rc@gmail.com > wrote in message
news:eX******** ******@TK2MSFTN GP09.phx.gbl...
> how to detect file is completely downloaded from client by following code? >
> <%@ Page language="C#" debug="true" %>
> <script language="C#" runat="server">
> private void Page_Load(objec t sender, System.EventArg s e) {
> Response.Conten tType="applicat ion/zip";
> Response.Append Header("Content-Disposition","a ttachment;
> filename=myzipf ile.zip");
> Response.WriteF ile(@"c:\inetpu b\wwwroot\myzip file.zip");
> Response.Flush( );
> }
> </script>
>
>



Nov 19 '05 #4
this has the minor hole, that the last write may not be received by the
client even though the server successfully sent it..

-- bruce (sqlwork.com)
"Matt Dockerty" <Ps reply to group> wrote in message
news:eE******** ******@TK2MSFTN GP15.phx.gbl...
"Marina" <so*****@nospam .com> wrote in message
news:Or******** ******@TK2MSFTN GP12.phx.gbl...
You can't. Once the file is sent, you have no way of knowing how long it
travels over the web, or how slow the other person's connection is, or
how
long it takes. Once you send it, your job is done.


Um, wrong, you don't just chuck a file onto the Internet and hope it
reaches
it's destination. A stateful connection takes place.

There is a solution. You could send it about 512 bytes a time with
Response.Binary Write / Response.Flush and check for
Response.IsClie ntConnected between each block. If that is ever false, the
connection has dropped and the user doesn't have their file.

--
Matt
"RC" <rc@gmail.com > wrote in message
news:eX******** ******@TK2MSFTN GP09.phx.gbl...
> how to detect file is completely downloaded from client by following code? >
> <%@ Page language="C#" debug="true" %>
> <script language="C#" runat="server">
> private void Page_Load(objec t sender, System.EventArg s e) {
> Response.Conten tType="applicat ion/zip";
> Response.Append Header("Content-Disposition","a ttachment;
> filename=myzipf ile.zip");
> Response.WriteF ile(@"c:\inetpu b\wwwroot\myzip file.zip");
> Response.Flush( );
> }
> </script>
>
>



Nov 19 '05 #5
"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:ei******** ******@TK2MSFTN GP09.phx.gbl...
this has the minor hole, that the last write may not be received by the
client even though the server successfully sent it..
HTTP 1.1 has persistent connections where the connection remains open for a
little while after the file is recieved in case the client wants something
else from the server. Unless the client needs to talk in HTTP 1.0 (extremely
rare) or you're explicitly sending a 'Connection: close' header the last
block will be detected too.

-- bruce (sqlwork.com)
"Matt Dockerty" <Ps reply to group> wrote in message
news:eE******** ******@TK2MSFTN GP15.phx.gbl...
"Marina" <so*****@nospam .com> wrote in message
news:Or******** ******@TK2MSFTN GP12.phx.gbl...
You can't. Once the file is sent, you have no way of knowing how long it travels over the web, or how slow the other person's connection is, or

<snip>
Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2141
by: Pedro Fonseca | last post by:
Greetings! In my PHP website I'm trying to raise a File Download dialog directly in a WindowsCE IE client with the following code: header( "Content-Type: application/octet-stream\n" ); header( "Content-Disposition: attachment; filename=\"$file\"\n" ); header( "Content-Transfer-Encoding: binary\n" ); header( "Content-Length: " . filesize($path.$file) . "\n" );
4
2389
by: Billy Jacobs | last post by:
Is there a way to download multiple files from a server? If not then: How do I zip up multiple files using the .net classes in vb? Thanks Billy Jacobs
1
5884
by: Vasu | last post by:
Hi, I have a requirement to download a file from the web site using a client tool. Iam writing a C# program to download using WebRequest, HttpRequest, WebResponse and so on. The problem Iam having is to navigate thru multiple pages. I have to login
9
15083
by: Glen | last post by:
I'm writing a console utility to download specific files from web sites based on the command line options. In most cases, I can trap the 404 error when the file isn't available because the operator mistyped the URL or it's offline for whatever reason. The problem I'm running into is with certain sites where the admin has set up a redirect to handle the 404 condition and redirects the request to another page. In this case, the...
1
5399
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved completely/succsessfully on the client's computer before updating some metadata on the server (file downloaded date for instance) However, All examples i have tried, and all examples I have found that other people says works - doesn't work for me :-(
13
2434
by: Shailesh Humbad | last post by:
Here is an advanced PHP question. Can anyone think of a way to detect the number of bytes written to output when a script is aborted? I am sending a large file to the client, and I want to record how many bytes are actually sent. I can detect abort of the script using a shutdown handler. In the shutdown handler, I tried ob_get_length, but it returns false. I tried to read the server's log file, but it is does not contain the...
22
4007
by: petermichaux | last post by:
Hi, I'm curious about server load and download time if I use one big javascript file or break it into several smaller ones. Which is better? (Please think of this as the first time the scripts are downloaded so that browser caching is out of the equation.) Thanks, Peter
0
2145
by: ar | last post by:
Hello, In IE I disable "Automatic prompting for file downloads" which causes the IE information bar to show up when I try to push a file download from an iframe. I want to keep this behaviour. When clicking "Download file..." on the information bar, a postback occurs. I would like to detect this postback. The file that is going to be downloaded is generated by a rather heavy export, now the export is running twice. Once before the...
2
23900
by: Dan D | last post by:
I have a large install file (an exe) on my web server that people download and install from. Looking at my log files, I see a lot of people downloading it, but no way to tell for sure if they completed the download or cancelled out before it completed. Is there any function in PHP that would allow the web server to send the file and detect a completion or cancellation? Or perpahs a javascript/PHP method? Any help would be greatly...
0
9531
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7332
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.