上载特定于特定用户登录的文件 [英] Upload files specific to specific user logins

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

问题描述

你好,



我是asp.net和web开发的初学者,最近我开始研究用户帐户和登录。这一切都运行良好,用户可以登录和注销等。我的下一个任务是上传服务器/数据库上的文件,这是我成功实现的。所以,现在我可以上传文件,将它们从服务器/数据库中删除等等。现在,我遇到的问题是在尝试上传文件时,我希望它是特定于用户的。



因此,例如:如果人'A'正在上传文件1,2,3。我希望它留在服务器/数据库上,并在他再次登录时显示它们。如果'B'人正在上传8和9,对他也是如此。



所以,在这种情况下,有人可以指导我一些教程或任何帮助我可以用来试图实现这个目的吗?

Hello,

I am a beginner at asp.net and web development and recently I have started working on user accounts and login. That all works well, a user can login and logout etc. My next task was to upload files on the server/database, which I was successfully able to achieve. So, now I can upload files, remove them from the server/database etc. Now, the problem that I am facing is when trying to upload files, I want it to be user specific.

So, for example: If person 'A' is uploading files 1,2,3. I want it to stay on the server/database and show them when he logs in again. If person 'B' is uploading 8 and 9, likewise for him too.

So, in this case, could someone direct me to some tutorials or any help that I could use in trying to achieve this?

推荐答案

你可以:



1.使用私人文件夹 - 为每个用户创建一个文件夹,让他们只使用他们的私人文件夹(然后也可以添加共享文件夹等)。

2.你可以管理权限。这可以在应用程序级别完成 - 保存用户上传的文件记录,数据库中的内容以及管理用户看到的内容以及相应的写入/读取内容,或者可以根据授权级别完成,您可以管理基于Windows的文件权限。



干杯,

Edo
You can:

1. Use private folders - create a folder for each user and have them work with their private folder only (and then perhaps also add a shared folder etc).
2. You can manage permissions. This can be done either on the application level - keep records of the files uploaded by the users, in your DB and manage what users see and what they can write/read accordingly, OR it can be done based on authorization level, you can manage the windows based permissions of the files.

Cheers,
Edo


每个用户都有唯一的ID吗?

有很多方法......



当您保存在数据库中时,请标识具有用户ID的行。



如果将其保存为文件,请使用用户ID创建文件夹,例如files /%id%/并保存文件。您可以使用路径和System.IO.Directory.GetFiles按用户列出文件。



您可以将它保存在数据库中,使用用户ID和Guid或路径来识别文件,它将很容易列出并显示链接用户,比如网格或其他东西。
Do you have a unique id for each user?
There are many ways...

When you save in the database, identify the row with the user id.
Or
If you save it as a file, create folders with user ids like "files/%id%/" and save files inside. You can list files by user using the path and System.IO.Directory.GetFiles.
Or
You can save it in the database, using the user id and a Guid or the path to identify the file, it will be easy to list and show a link to user, like in a grid or something.


这篇关于上载特定于特定用户登录的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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