Jump to content

Count of total Downloads......not getting correctly


leela

Recommended Posts

Hai,

 

Thanks for ur help to my previous question !

 

I need the count for total downloads ..This is my code :

 

$file="personal_photos/".$arr[0]['path'];

 

if(file_exists($file))

{

$file_type = filetype($file);

                        header("Content-Type:".$file_type);

header("Content-Disposition: attachment; filename=".basename($file));

header( "Content-Description: File Transfer");

$download = @readfile($file);

if($download)

{

$query = "UPDATE tbl_images SET hits = hits + 1 WHERE id='".$id_img."' ";

$result = mysql_query($query) or die(mysql_error());

header("Location:image_download.php");

exit(0);

}

}//if(file_exists($file))

 

Whats my problem is...as soon as i click on download button , the count is increased..

 

But i need the count increased only after open / save is clicked and not on cancel..

 

i tried using javascript also,but no use..

 

Plz someone help me

 

Thanks,

Leela

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.