Prevent name of document uploaded to wix media manager when downloading using URL

Question: How to preserve the name of a document while downloading using a URL from Wix Media Manager?

Product: Wix Media Manager

What are you trying to achieve: I have uploaded a sample document to my site and provided a link to it on the website. The document name is sample.csv, but when downloading, its name changes to a unique name assigned by Wix, such as c0c19a_1ec051b0f1f04d6eb1aa0e64f87b75e0.csv.

I would like the downloaded file to have the original name sample.csv.

Is this achievable?

Try this code,

import { mediaManager } from 'wix-media-backend';

export async function getCustomDownloadUrl(fileUrl) {
  const downloadUrl = await mediaManager.getDownloadUrl(fileUrl, null, "sample.csv");
  return downloadUrl;
}

1 Like