Php file downloads are implemented by using php headers based on database records. Php file downloads are implemented by using php headers based on database records.
Script ec (2); script
The Code is as follows: |
|
Include './admin/connect. php '; @ Extract ($ db-> get_one ("select * from movieinfo where id = '". $ _ GET ['id']. "'"); $ Db-> query ("update movieinfo set downnum = downnum + 1 where id = '". $ _ GET ['id']. "'"); // Control download $ Url2 = "./admin/"; // path for storing movies If ($ localaddress) { $ Newname = $ localaddress; $ Movieurl = $ url2. $ newname; }
$ Type = basename ($ movieurl ); $ Type = substr (strrchr ($ type, '.'), 0 ); $ Filename = $ title. $ type;
$ File = fopen ($ movieurl, 'R '); Ob_end_clean (); Header ('content-type: application/octet-stream '); Header ('Accept-Ranges: bytes '); Header ('Accept-Length: '. filesize ($ movieurl )); Header ("Content-Disposition: attachment; filename =". $ filename ); Echo fread ($ file, filesize ($ movieurl )); Fclose ($ file ); Exit; ?> |