# Download a media file

**URL:** <https://forum.servoy.com/t/download-a-media-file/10274>\
**Category:** Classic Servoy\
**Created:** [February 14, 2009, 9:45pm UTC](https://forum.servoy.com/t/download-a-media-file/10274 "2009-02-14T21:45:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kurtbleicken](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@kurtbleicken](https://forum.servoy.com/u/kurtbleicken)\
**Post date:** [February 14, 2009, 9:45pm UTC](https://forum.servoy.com/t/download-a-media-file/10274/1 "2009-02-14T21:45:02Z")

</div>

I don’t see how to download a file stored in a media field. Don’t want to open it, just download whatever kind of file it is to the desktop or other location of the users choice.

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [February 15, 2009, 7:14am UTC](https://forum.servoy.com/t/download-a-media-file/10274/2 "2009-02-15T07:14:13Z")

</div>

I guess rightclicking the field will give you the options you’re looking for…

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [February 16, 2009, 8:18am UTC](https://forum.servoy.com/t/download-a-media-file/10274/3 "2009-02-16T08:18:02Z")

</div>

Or have a look at the file plugin…

---

<div class="post-metadata">

**Author:** ![kurtbleicken](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@kurtbleicken](https://forum.servoy.com/u/kurtbleicken)\
**Post date:** [February 16, 2009, 6:25pm UTC](https://forum.servoy.com/t/download-a-media-file/10274/4 "2009-02-16T18:25:34Z")

</div>

Figured it out with a little help from a friend. Thought someone else might find this useful.

var mediafield = com\_email\_attach\_blob; //name of media field  
var fileName = plugins.file.showFileSaveDialog(); //let user choose destination and name

if (!mediafield)  
{  
var t = 1  
}  
else  
{  
var success = plugins.file.writeFile(fileName,mediafield);  
if (!success) plugins.dialogs.showWarningDialog(‘Warning’, ‘Could not write file’, ‘OK’);  
}
