英文:
How to download file Type XLSX
问题
我在assets中有一个文件

我希望这个文件可以在我的项目中下载
<button className='p-2 bg-green-600 my-3 text-white '>
<href='../../../Assets/file/form_upload_lead.xlsx'>下载上传格式</a>
</button>

我希望这个文件可以下载。当我下载这个文件时,结果如下

英文:
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

答案1
得分: 2
如果文件是公开的,应将其存储在public文件夹或其子目录中。
- 通常会将
Assets文件夹放在public文件夹中。 - 然后您可以在路径
/Assets/file/form_upload_lead.xlsx中访问(下载)该文件。
之后直接点击链接将触发文件的下载:
<button className='p-2 bg-green-600 my-3 text-white '>
<a href='/Assets/file/form_upload_lead.xlsx'>下载上传格式</a>
</button>
英文:
If the file is meant to be public it should be stored on the public folder or a subdirectory of it.
- You will typically place the
Assetsfolder onpublicfolder - Then You can (access) download the file in the path
/Assets/file/form_upload_lead.xlsx
After that clicking directly to the link will trigger the download of the file:
<button className='p-2 bg-green-600 my-3 text-white '>
<a href='/Assets/file/form_upload_lead.xlsx'>Download Format Upload</a>
</button>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论