简体   繁体   中英

Can I have a link automatically download a file in an email?

I have an email with a link to a video file stored on a cloud hosting service (backblaze)

I'm trying to make it so that when someone can clicks the link the file would start to download. Right now I have this:

<a href="https://f000.backblazeb2.com/file/Folder/video.mp4" download="video">Download Here</a>

That takes you to the video instead of downloading the file. I'd like to avoid that if possible and have the link prompt you to start downloading the file when you click on it.

Is this possible to do in an email when the file is stored on a server somewhere?

Thanks

I think you can't do this in plain html.
Since you can't use JavaScript in email, the best option would be to manage to include some PHP script in the server that do the job.

This example was taken from serverfault
PHP

?php
// We'll be outputting a MP4
header('Content-type: video/mp4');

// It will be called downloaded.mp4
header('Content-Disposition: attachment; filename="downloaded.mp4"');

// Add your file source here 
readfile('original.mp4');
?> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM