How to set URL direct donwloadable
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a short video sharing website. The user can download video from there. I'm facing some problem now. I want the user to download the video directly but when users visit my link browser auto-playing the video.
I only want when user click on link Video download will start auto.
Now I'm sharing video link like this
Example: www.example.com/examle.mp4
Please give me suggestion
php html web hosting cpanel
add a comment |
I have a short video sharing website. The user can download video from there. I'm facing some problem now. I want the user to download the video directly but when users visit my link browser auto-playing the video.
I only want when user click on link Video download will start auto.
Now I'm sharing video link like this
Example: www.example.com/examle.mp4
Please give me suggestion
php html web hosting cpanel
1
If you are using bootstrap. there is a tag with download to direct download. eg: <a href="YOUR_URL" download >Download</a>
– Gulshan
Nov 15 '18 at 10:11
Its not only about bootstarp. I want my link direct downloadable. I can share my URL anywhere, when visitor click on my URL, then browser will start downloading the video. I dont want it to play online.
– Tanjil Islam
Nov 15 '18 at 10:15
Not sure this needs any PHP involvement, as suggested in the two currently existing answers. Setting the Content-Type header should be enough for force a download, and that can be done in a RewriteRule directly, using theT
flag
– misorude
Nov 15 '18 at 10:40
add a comment |
I have a short video sharing website. The user can download video from there. I'm facing some problem now. I want the user to download the video directly but when users visit my link browser auto-playing the video.
I only want when user click on link Video download will start auto.
Now I'm sharing video link like this
Example: www.example.com/examle.mp4
Please give me suggestion
php html web hosting cpanel
I have a short video sharing website. The user can download video from there. I'm facing some problem now. I want the user to download the video directly but when users visit my link browser auto-playing the video.
I only want when user click on link Video download will start auto.
Now I'm sharing video link like this
Example: www.example.com/examle.mp4
Please give me suggestion
php html web hosting cpanel
php html web hosting cpanel
edited Nov 15 '18 at 10:11
D.Mendes
11810
11810
asked Nov 15 '18 at 10:09
Tanjil IslamTanjil Islam
113
113
1
If you are using bootstrap. there is a tag with download to direct download. eg: <a href="YOUR_URL" download >Download</a>
– Gulshan
Nov 15 '18 at 10:11
Its not only about bootstarp. I want my link direct downloadable. I can share my URL anywhere, when visitor click on my URL, then browser will start downloading the video. I dont want it to play online.
– Tanjil Islam
Nov 15 '18 at 10:15
Not sure this needs any PHP involvement, as suggested in the two currently existing answers. Setting the Content-Type header should be enough for force a download, and that can be done in a RewriteRule directly, using theT
flag
– misorude
Nov 15 '18 at 10:40
add a comment |
1
If you are using bootstrap. there is a tag with download to direct download. eg: <a href="YOUR_URL" download >Download</a>
– Gulshan
Nov 15 '18 at 10:11
Its not only about bootstarp. I want my link direct downloadable. I can share my URL anywhere, when visitor click on my URL, then browser will start downloading the video. I dont want it to play online.
– Tanjil Islam
Nov 15 '18 at 10:15
Not sure this needs any PHP involvement, as suggested in the two currently existing answers. Setting the Content-Type header should be enough for force a download, and that can be done in a RewriteRule directly, using theT
flag
– misorude
Nov 15 '18 at 10:40
1
1
If you are using bootstrap. there is a tag with download to direct download. eg: <a href="YOUR_URL" download >Download</a>
– Gulshan
Nov 15 '18 at 10:11
If you are using bootstrap. there is a tag with download to direct download. eg: <a href="YOUR_URL" download >Download</a>
– Gulshan
Nov 15 '18 at 10:11
Its not only about bootstarp. I want my link direct downloadable. I can share my URL anywhere, when visitor click on my URL, then browser will start downloading the video. I dont want it to play online.
– Tanjil Islam
Nov 15 '18 at 10:15
Its not only about bootstarp. I want my link direct downloadable. I can share my URL anywhere, when visitor click on my URL, then browser will start downloading the video. I dont want it to play online.
– Tanjil Islam
Nov 15 '18 at 10:15
Not sure this needs any PHP involvement, as suggested in the two currently existing answers. Setting the Content-Type header should be enough for force a download, and that can be done in a RewriteRule directly, using the
T
flag– misorude
Nov 15 '18 at 10:40
Not sure this needs any PHP involvement, as suggested in the two currently existing answers. Setting the Content-Type header should be enough for force a download, and that can be done in a RewriteRule directly, using the
T
flag– misorude
Nov 15 '18 at 10:40
add a comment |
3 Answers
3
active
oldest
votes
Thank you guys for answering. I want my URL to make direct downloadable. You guys are suggesting me for php file but i found a solution online. This work.
I just need to put this code on .htaccess
<FilesMatch ".(mp4|MP4)">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
This works perfectly.
Thank you Guys
add a comment |
<?php
$file = "www.example.com/examle.mp4";
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename='" . basename($file) . "'");
readfile ($file);
exit();
?>
1
Your answer need more explanation about how the code works to be a good answer.
– Foo
Nov 15 '18 at 14:48
add a comment |
instead of linking to the video file directly you could link to a php file which does trigger the download for you.
<?php
header('Content-disposition: attachment; filename=movie.mp4;');
header('Content-Length: '. filesize('movie.mp4'));
readfile('movie.mp4');
exit;
With .htaccess
you could redirect the mp4 link to your php file.
RewriteEngine on
RewriteRule ^movie.mp4$ ./movie.php
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53316986%2fhow-to-set-url-direct-donwloadable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thank you guys for answering. I want my URL to make direct downloadable. You guys are suggesting me for php file but i found a solution online. This work.
I just need to put this code on .htaccess
<FilesMatch ".(mp4|MP4)">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
This works perfectly.
Thank you Guys
add a comment |
Thank you guys for answering. I want my URL to make direct downloadable. You guys are suggesting me for php file but i found a solution online. This work.
I just need to put this code on .htaccess
<FilesMatch ".(mp4|MP4)">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
This works perfectly.
Thank you Guys
add a comment |
Thank you guys for answering. I want my URL to make direct downloadable. You guys are suggesting me for php file but i found a solution online. This work.
I just need to put this code on .htaccess
<FilesMatch ".(mp4|MP4)">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
This works perfectly.
Thank you Guys
Thank you guys for answering. I want my URL to make direct downloadable. You guys are suggesting me for php file but i found a solution online. This work.
I just need to put this code on .htaccess
<FilesMatch ".(mp4|MP4)">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
This works perfectly.
Thank you Guys
<FilesMatch ".(mp4|MP4)">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
<FilesMatch ".(mp4|MP4)">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
answered Nov 15 '18 at 10:45
Tanjil IslamTanjil Islam
113
113
add a comment |
add a comment |
<?php
$file = "www.example.com/examle.mp4";
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename='" . basename($file) . "'");
readfile ($file);
exit();
?>
1
Your answer need more explanation about how the code works to be a good answer.
– Foo
Nov 15 '18 at 14:48
add a comment |
<?php
$file = "www.example.com/examle.mp4";
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename='" . basename($file) . "'");
readfile ($file);
exit();
?>
1
Your answer need more explanation about how the code works to be a good answer.
– Foo
Nov 15 '18 at 14:48
add a comment |
<?php
$file = "www.example.com/examle.mp4";
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename='" . basename($file) . "'");
readfile ($file);
exit();
?>
<?php
$file = "www.example.com/examle.mp4";
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename='" . basename($file) . "'");
readfile ($file);
exit();
?>
answered Nov 15 '18 at 10:17
Banujan BalendrakumarBanujan Balendrakumar
9921213
9921213
1
Your answer need more explanation about how the code works to be a good answer.
– Foo
Nov 15 '18 at 14:48
add a comment |
1
Your answer need more explanation about how the code works to be a good answer.
– Foo
Nov 15 '18 at 14:48
1
1
Your answer need more explanation about how the code works to be a good answer.
– Foo
Nov 15 '18 at 14:48
Your answer need more explanation about how the code works to be a good answer.
– Foo
Nov 15 '18 at 14:48
add a comment |
instead of linking to the video file directly you could link to a php file which does trigger the download for you.
<?php
header('Content-disposition: attachment; filename=movie.mp4;');
header('Content-Length: '. filesize('movie.mp4'));
readfile('movie.mp4');
exit;
With .htaccess
you could redirect the mp4 link to your php file.
RewriteEngine on
RewriteRule ^movie.mp4$ ./movie.php
add a comment |
instead of linking to the video file directly you could link to a php file which does trigger the download for you.
<?php
header('Content-disposition: attachment; filename=movie.mp4;');
header('Content-Length: '. filesize('movie.mp4'));
readfile('movie.mp4');
exit;
With .htaccess
you could redirect the mp4 link to your php file.
RewriteEngine on
RewriteRule ^movie.mp4$ ./movie.php
add a comment |
instead of linking to the video file directly you could link to a php file which does trigger the download for you.
<?php
header('Content-disposition: attachment; filename=movie.mp4;');
header('Content-Length: '. filesize('movie.mp4'));
readfile('movie.mp4');
exit;
With .htaccess
you could redirect the mp4 link to your php file.
RewriteEngine on
RewriteRule ^movie.mp4$ ./movie.php
instead of linking to the video file directly you could link to a php file which does trigger the download for you.
<?php
header('Content-disposition: attachment; filename=movie.mp4;');
header('Content-Length: '. filesize('movie.mp4'));
readfile('movie.mp4');
exit;
With .htaccess
you could redirect the mp4 link to your php file.
RewriteEngine on
RewriteRule ^movie.mp4$ ./movie.php
answered Nov 15 '18 at 10:25
AndreasAndreas
443
443
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53316986%2fhow-to-set-url-direct-donwloadable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
If you are using bootstrap. there is a tag with download to direct download. eg: <a href="YOUR_URL" download >Download</a>
– Gulshan
Nov 15 '18 at 10:11
Its not only about bootstarp. I want my link direct downloadable. I can share my URL anywhere, when visitor click on my URL, then browser will start downloading the video. I dont want it to play online.
– Tanjil Islam
Nov 15 '18 at 10:15
Not sure this needs any PHP involvement, as suggested in the two currently existing answers. Setting the Content-Type header should be enough for force a download, and that can be done in a RewriteRule directly, using the
T
flag– misorude
Nov 15 '18 at 10:40