i Got the problem, my problem with high files. for example i have a 20mb file, its run without problem. them i give it 50mb file. its not load.....
this is my code:
$file = './' . $elements[ $oindex ] . DIRECTORY_SEPARATOR . $elements[ $otype ] . DIRECTORY_SEPARATOR . $elements[ $odate ] . DIRECTORY_SEPARATOR . urldecode( $elements[ $ofile ] );
after this i send data fo output function. the output code:
$file = fopen( $filename, 'r' );
$mimetype = mime_content_type( $file );
header( 'Content-Type: ' . $mimetype );
echo fpassthru( $file );
fclose( $file );
its work for all formats but when i use url like this:
http://localhost/onwebsite_ir/c/files/ow_free/2018-11/y2mate.com%20-%20retrain_your_mind_new_motivational_video_very_powerful_xp2qjshr-r4_1080p.mp4
its not work....
then use this urls :
http://localhost/onwebsite_ir/c/files/ow_free/2018-11/NO%20EXCUSES%20-%20Best%20Motivational%20Video.mp4
http://localhost/onwebsite_ir/c/files/ow_portable_ocourses_on/2018-11/01%20-%20Introduction%20to%20the%20Tools%20used%20in%20Mobile%20Repairing%20(English).jpg
it will work without any problem
i test any wayse but it not work...
there is problem with video files...
please help me....
Its Downloader Plugin (Check Access Users To Download Files) On Wordpress
after this i update my code to:
$file_size = filesize( $filename );
$file = @fopen( $filename, "rb" );
if ( $file ) {
header( "Content-Disposition: attachment; filename=\"$fn\"" );
header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
header( "Content-Length: $file_size" );
$mimetype = mime_content_type( $file );
header( 'Content-Type: ' . $mimetype );
set_time_limit( 0 );
if ( $t == 'ow_free' ) {
echo fpassthru( $file );
}
fclose( $file );
}
after some tests i got underestand my problem with high files then i used this code for download:
$file_size = filesize( $filename );
$file = @fopen( $filename, "rb" );
if ( $file ) {
header( "Content-Disposition: attachment; filename=\"$fn\"" );
header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
header( "Content-Length: $file_size" );
$mimetype = mime_content_type( $file );
header( 'Content-Type: ' . $mimetype );
set_time_limit( 0 );
fseek( $file, 0 );
while ( ! feof( $file ) ) {
print( @fread( $file, 1024 * 8 ) );
ob_flush();
flush();
if ( connection_status() != 0 ) {
@fclose( $file );
exit;
}
}
its works... but when i played video by this way or downloading, my website goes down... is the other ways?