views:

64

answers:

1

hail, i have a problem to serve file with PHP into client. that when i want to download it the save and open dialog will be appear but progress of download will not show. what is my problem?

header that i send it to client:

header('Content-Type: ');
header('Content-Description: File Transfer');
header('Accept-Ranges: bytes');
header('Content-Transfer-Encoding: binary');

save dialog

http ://vzz.ir/files/kn5gsecfnoia1cqkfop6.jpg

progress not show in ip.

http ://vzz.ir/files/88ruak7ocjgn10ha9mda.jpg

A: 

You should set header with file size to make progress bar appear. Content-type also should be specified, use application/ocet-stream for unknown mime type (or to force download).

header('Content-Type: application/ocet-stream');
header('Content-Disposition: attachment; filename=test.dat');
header('Content-Length: '.filesize('test.dat'));
header('Content-Description: File Transfer');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
readfile('test.dat');
exit; 
dev-null-dweller
both of theme is affected but progress problem is still. :(
sweb