So you want to create a URL to an image or video that you've uploaded to the Media Manager ?
The simplest way is to use a static URL like this:
let imageUrl =`https://static.wixstatic.com/media/${fileName}`;
Keep reading for what fileName really means.
There's a bit of confusion about getFileUrl, so let's clear some things up.
getFileURL gives you a download URL with a token.
The token will expire after 600 minutes so if you want to get to your file after 10 hours using the returned URL, this function is not for you.
The nice thing about getFileURL is that you can use it for content where you don't want to make the URL permanently available.
If you want to use the link to your file for more than 10 hours you need to regenerate the URL and token, or you can use a static link as shown above.
So what is fileName ?
fileName is not the name of the file in the UI of the Media Manager.
The fileName that you want for your URL is a unique identifier assigned by the Media Manager when you upload a file using upload() or importFile() or getFileInfo() and can be found in the objects returned by each of these functions.
If you want to see the fileName in the UI:
Open the Media Manager.
Select a file.
Click on the down arrow next to File Info.
Click Copy URL .
Do a Paste somewhere to see the static URL including the filename .
You'll get something like:
https://static.wixstatic.com/media/81c916_38c28d77469d40419732e0667200eb48~mv2.jpeg
UPDATE:
Follow the steps in this article to get your media file's URL. As stated above, fileName will be in the URL. However, each media type has a different format for the fileName string as follows: Image/GIF:
https://static.wixstatic.com/media/{22d494_cb2a8a381bb1495e9a320ae23f4fd18d~mv2.gif} Video: https://video.wixstatic.com/video/{22d494_fef6ff6f52b04b4aa1e1c0ab6d1bb194}/360p/mp4/file.mp4 Audio: https://static.wixstatic.com/mp3/{22d494_5543f167bf1c45ea984bc76e699b457b.mp3} Document:
https://8b7eef41-7fbb-440b-928a-a442878112a3.usrfiles.com/ugd/{22d494_bddbcfb54d4442a7a042a3ab81347458.pdf}