Hi everybody,
I displaying file download window("save-as dialog box") using PHP "header()" function.
How to track that user have clicked "save" button or "cancel" button???
6 1575 ak1dnar 1,584
Recognized Expert Top Contributor
Hi I don't have a idea about how to trap the click events of the buttons that displays under out side the browser window.
could you please submit the Script that you used for display the save as Dialog box.
Atli 5,058
Recognized Expert Expert
Hi.
I doubt that you can access the download dialog from your scripts.
I would think the browser runs any process, with access to you data, out of reach from any client script.
Hi.
I doubt that you can access the download dialog from your scripts.
I would think the browser runs any process, with access to you data, out of reach from any client script.
Exactly what I think. The whole download process is executed outside your program control.
Ronald :cool:
-
-
function download()
-
{
-
-
header("Pragma: public");
-
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
-
header("Expires: 0");
-
-
header("Content-Transfer-Encoding: binary");
-
header('Content-Disposition:' . $this->cont_dis .';'
-
. ' filename="' . $this->name . '";'
-
. ' modification-date="' . $this->mod_date . '";'
-
. ' size=' . $this->fsize .';'
-
);
-
header("Content-Type: " . $this->mime ); // MIME type
-
header("Content-Length: " . $this->fsize);
-
-
-
$total_bytes=readfile_chunked($this->path.$this->name);
-
}
-
-
function readfile_chunked($filename)
-
{
-
$chunksize = 1*(1024*1024); // how many bytes per chunk
-
$buffer = '';
-
$cnt =0;
-
$handle = fopen($filename, 'rb');
-
-
if ($handle === false)
-
{
-
return false;
-
}
-
while (!feof($handle))
-
{
-
$buffer = fread($handle, $chunksize);
-
if(print $buffer)
-
{
-
$cnt += strlen($buffer);
-
}
-
-
}
-
fclose($handle);
-
-
return $cnt; // return num. bytes delivered like readfile() does.
-
-
}
-
-
This is the code i am using to display "save-as" dialog box and to send content to the browser.
Actually I am logging every download from my site. So , If the user clicks on "cancel" in the "save-as" dialog box, I should not log it.
Pl provide any sol for this.
ak1dnar 1,584
Recognized Expert Top Contributor
Your script will call to a property (Download-Box) that is completely out side the browser window. so there is no way to trap that click events.
so before you call for the headers you have to trap it. but in that case you can't determine whether the user completely downloaded the file or not only thing you can do by giving to buttons like Accept and Reject you have to trap the events.
Your script will call to a property (Download-Box) that is completely out side the browser window. so there is no way to trap that click events.
so before you call for the headers you have to trap it. but in that case you can't determine whether the user completely downloaded the file or not only thing you can do by giving to buttons like Accept and Reject you have to trap the events.
Accept or Reject buttons will ensure only whether the user wants to download or not. But I wanted to know predict the button clicked in the "Save-As" dialog-box.
Anyway, as per your answer I came to know that, the download dialog-box action is out of our control. So thanks.
Thnx for all your replies.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Stijn Goris |
last post by:
Hi all,
I have a question regarding the header function. I send a browser to a
certain page (eg first.php ) wich sends no output to the browser. This page
sends the browser to another page (eg second.php) with the
header("Location:") function. second.php doesn't either send any output to
the browser. The browser is then send to another page also with the header()
function.
Now my problem: I have to send user and password data...
|
by: Danny Anderson |
last post by:
Hola, PHP folk!
I have a php page that contains a self-processing form. The form holds
search results. The search terms originally came from the previous page,
but the user can repeatedly refine the results on the page in question
until the target item can be found. This search refinement is where the
self-processing form comes to play.
The search results are listed in a table with a radio button at the end of
each row. What I...
|
by: Francisco Mendez |
last post by:
I get the following message when trying to run my script:
"Warning: Cannot modify header information - headers already sent by (output
started at /var/www/html/newcustomer.php:23) in
/var/www/html/newcustomer.php on line 332"
....newcustomer.php:23 is where my script begins, at line 23.
before that line, only comments.
|
by: bissatch |
last post by:
Hi,
I am trying to use the following function:
header("Location: http://www.mysite.co.uk/home/update/index.php");
....but getting the following error:
Warning: Cannot modify header information - headers already sent by
(output started at
|
by: beliavsky |
last post by:
Ideally, one can use someone's C++ code by just looking at the header
files
(which should contain comments describing the functions in addition to
function definitions), without access to the full source code. Can
analogs of C++ header files be created for Python code?
Python "header" files could list only the 'def' statements and
docstrings of Python functions and classes, but that does not tell you
what the functions return. One could...
| |
by: Roger |
last post by:
I couldn't find anything at
http://www.mvps.org/access/reports/index.html
I have a report with static (name, address, etc) in its report header
and a subreport in the report's detail section
the subreport has column headings in both its report and page headers
(until I figure out which is best)
when I print the report, the subreport headings show on the first
|
by: lwoods |
last post by:
I am trying to pass some info to another page on my site. I set
"session_start()" in page 1, assign a session variable to a value, then
execute a "header('Location: ....')." But on the target page I don't get
any session variable values! BTW, I used a relative location in the
Location header, not an absolute URL. The behavior looks like it started
another session, but it should not have.
Ideas?
TIA,
|
by: cman |
last post by:
does anyone know why i can't generate images with:
header("Content-type:image/jpeg");
imagejpeg($img_number);
i've tried different examples but i always get a text output as if the
header doesn't make a difference at all.
<?php
//random_number.php
$img_number = imagecreate(100,50);
|
by: universalbitmapper |
last post by:
Hi,
I'm trying a simple form.html that call a .html script that begins
with:
<?php
header("This is a test");
?>
When I click on the link, I get blank page.
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |