如何上传和下载文件 [英] How to upload and download a file

查看:85
本文介绍了如何上传和下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我喜欢在我的项目中上传文件.当我单击上载按钮时,文件应存储在客户端系统中,文件名和路径应存储在数据库中.当我单击下载按钮时,应该根据我存储在数据库中的文件名和路径下载它.进行更改后,应将其上传为其他文件名,并且不会影响以前的文件内容.如果该过程有任何代码,请发送给我.


在此先感谢

Hi,

I like to upload an file in my project. when I click the upload button the file should be stored in client system and the file name and path should be stored in the database. When I clicking the download button it should be downloaded based on the file name and path that I have stored in the database. After making the changes it should be uploaded as different file name and it will not affect the previous file content. If there is any code for this process please send it to me.


Thanks in advance

推荐答案

开始

您可以按照以下步骤操作:
1.单击上传"按钮意味着您的代码将从客户端提供的路径中读取文件,并将文件保存在您提到的路径中.
2.当您正在读取文件时,可以将客户端路径存储在db中.
3.当某些主体将下载文件时,他们应该提供一些路径,您的代码将在该路径中写入文件.

对于代码示例,您可以检查
.

我在db中有一个疑问,什么是存储路径和文件名的主键?
是文件名吗?
我担心的是文件名可能不是唯一的.

希望对您有帮助.
You can follow the below steps:
1.Upload button click means your code will read the file from the client provided path and will save the file in your mentioned path.
2.When you are reading the file that time you can store the client path in db.
3.When some body will down load the file then they should provide some path where your code will write the file.

For code sample you can check this.

I have one doubt in db what will be the primary key for storing the path and file names?
Is it file name?
My concern is File name may not be unique.

Hope this will help you.


这篇关于如何上传和下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆