I have file in assets
and i hope this file can download in my project
<button className='p-2 bg-green-600 my-3 text-white '>
<href='../../../Assets/file/form_upload_lead.xlsx'>Download Format Upload</a>
</button>
i hope this file can download. when i download this file the result like this
2
Answers
Firstly, you need to use the correct syntax for the anchor
<a>
tag.Also, you might want to serve the file from a public folder that is accessible by the web server. Typically in Next.js, we use the public directory for this. Anything inside the public directory can be accessed via
If the file is meant to be public it should be stored on the
public
folder or a subdirectory of it.Assets
folder onpublic
folder/Assets/file/form_upload_lead.xlsx
After that clicking directly to the link will trigger the download of the file: