File Upload - how to identify which user uploaded which files??

Hi,  I am using the file upload code at the link below to allows users to upgrade multiple files into  a storage area.

My question is how do I identify which files belong to which user??

On my site i am using ASP membership and before uploading files users must logg on.

Does this mean I can use the UserID to identify them or is there another simple wayI

I have the file upload in a simple wizard form.

Also i am coding in C sharp


Thank you



4/21/2008 3:21:42 PM 91979 articles. 4 followers. Follow

9 Replies

Similar Articles

[PageSpeed] 38
Get it on Google Play
Get it on Apple App Store

You can use the logged in user, save the filename and user ID to a database table and you have a record.


Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
4/21/2008 3:25:54 PM

Hi ,

 thank you for the suggestion.

Could you provide an example in code how to acheive this in C Sharp.


4/21/2008 3:59:21 PM



You had better know about Membership. You can check this video:

1. You can drop a Login Control into web page, and it will build the membership database ASPNETDB.mdf(SQL Express) in App_Data folder. You can change the database provider by using the following link:

2. Then you need drop a CreateUser Control into web page to create some users. And you can use Login Control to log in.

Login Control Sample:

It can be implemented without C# code but HTML Code and configuration.

The quickstarts of membership you can check this for the codes:

Hope it helps.

Vince Xu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
4/23/2008 6:32:12 AM

Hi, Thank you for the reply.

On my site I already use the create user wizard which enables users create an account and logg on.

On logging on they have access to a another form which gets information from the user about their preferences - on clicking the

finish button of this form  the answers are inserted into a database table.

Within this form  there is a file upload control and the files which the user attaches will be stored in a directory called "fileUploads".

What I want to happen is that in the database table, I have a column which stores the path to the files that were uploaded by the user so

I can identify which files were uploaded by which user

Could you advise on how to do this with some examples

thank you


4/24/2008 10:25:49 AM


At firstly, pay attention that you can't modify the structure of tables in membership db. So the file information should be stored in other places.

And then there are two approachs can achieve your purpose.

1. Use Profile.(The best approach for you.)

   You can define firstname, lastname and NTID as the attributes of users. These attributes called Profile in membership.

Profile in MemberShip is to store the information on users who can be login user or anonymous user. The information will be store in the database.

1). Configure in Web.Config. You can set <anonymousIdentification enabled="true"/> to permit all of the user use profile, and the information of it will be stored in database. The make-up "allowAnonymous=True" can allow using profile for anonymous user.

<anonymousIdentification enabled="true"/>
<add name="FirstName" allowAnonymous="true"/>
<add name="LastName" allowAnonymous="true"/>
<add name="LastVisited" allowAnonymous="true"/>
<add name="Work" allowAnonymous="true"/>
<add name="Education" allowAnonymous="true"/>

 As to login user, you have to use the membership controls, such as Login.

  2). Via Profile.FirstName = "username", you can set the value to this profile.

As to retrieving data from profile, you can use this:

Labal1.Text = "First name: " + Profile.FirstName;
Label2.Text = "Work :" + Profile.Work;

Befor that, you have to implement user management by using membership.

You can get more information about profile by using the following link

2. You can create some table in membership db in order to extend membership database and set the primary key as UserID which is connected with table aspnet_Users.

But this approach is not secured. My suggestion is if the approch one can't satisfy you, you can use approach two.

Hope it helps.

Vince Xu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
4/25/2008 2:05:53 AM

Hi Vince,

 Thanks for the tip.

Could you explain the following.

If  a logged in user uploads a file to the storage area on the server / how can I associate the file uploaded  with the user?

4/25/2008 11:53:58 AM


After user logged in, you can use Profile.FilePath="" to store the upload path into the profile according the username who has logged in.

It will be stored in the database. Next time, after this user logged in, you can use Profile.FilePath to get the path from database directly.

Before that, please configure the profile and attribute Profile.FilePath according to my last post.

Vince Xu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
4/28/2008 2:13:15 AM

 Will this also work if user have uploaded multiple files??

4/28/2008 3:00:14 AM

One profile variable support one value. You need split them with some especial character like path1|path2|path3|

Vince Xu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
4/28/2008 3:11:49 AM

Similar Artilces:

How to identify the original file type and restrict the file uploading while using file upload control
 Hi , I am uploading a file using FileUpload control in using wrote the code to upload only PDF files. the user can change the extension and change to PDF . I have to check is the file original PDF or not then i have to upload the PDF files only . How to do this ??  Hi, Check the file Mime type for "application/pdf" by looking at the:  FileUpload1.PostedFile.ContentType RegardsSmcoxonNo Gem is ever polished without some friction. Hi smcoxon , Thanks For Replying ,But i found that there is no use using PostedFil...

file uploader save file on server and in database and upload this file on client
hi,i have a file uploader control user can attach files (.rar, .zip, etc) and store file folder and path in database. and another user can click of attach link and can download that file. how can i do this please solve out this problem. you can find your problem solution in this link and you can store the file name in your database server. Mark as Answred If This Blog has Helped You.RegardsMitesh Darjihttp://www.indianic.com As always there are many ways and which ...

Posting filepath in file upload control in .NET to the next page and uploading the file from second page
In our application (using C# .NET) there is a form with file upload options. After filling up the form details, the summary of the details need to be shown in the next page before committing the information into the database. Right now, Server.Control is used to transfer the contents to the next page and the form details are retrieved using Request.Form["control id"]. But this is not working for File upload control alone.File upload can not be done in the first page itself, as the foreign key in File upload table gets updated only in second page after confirmation. Therefore, is th...

file upload extensions
Is it possible to upload any/some video files? I tried to add file extentions under the host settings but it didn't work. Wonder if if it's possible in dnn to upload any video files?Thanks. It is possible to upload files of any extension (as far as I know).  You might be hitting a file size constraint?  I've never tried uploading any really huge files - maybe someone else with comment about that?-doug, Powerhouse Data Yes, you can upload video files.  I've uploaded them and used with core modules as well as MediaGallery.  By default, DNN has a max upload size of 8MB...

Deleting A File Uploaded Through File Upload Control
Hello, I have a form which allows a user to upload a file to a virtual drive on our server using the following code: fileInvoice.SaveAs(ConfigurationManager.AppSettings.Get("DocumentPath") + strFileName); //Document Path is defined in the web.config file How can I safely allow a form on a web page to delete the file if they know the exact name of the file. I don't want them to be able to do a wildcard match like test* thanks in advance, mitch  Peace be on you brother, so you want to safely delete the file which the name you know. OK I consider that the name ...

Upload all files in folder with file upload control
H i I'm trying to upload all files to a wesite that is in a specific local folder. My code workes fine when I run it locally but when I upload it it fails. I think it looks for the files to upload on the web server and thus cannot find it.  1 Dim files() As String 2 folderExists = System.IO.Directory.Exists(foldername) 3 If folderExists = False Then 4 Label1.Text = "Folder does not exist. Did you enter a folder name or just a file name ?" 5 Exit sub 6 End If 7 files = System.IO.Directory.GetFiles(foldername) 8 For...

File Upload
Hey I've got a fileUpload control on an aspx page that works fine for the accepted file type, .rpts, and brings up the correct error message for not allowed extensions such as .exes and .jpgs. But .pdf files should cause an error message to be displayed, as only .rpt files are allowed to be uploaded, but instead it brings up a blank page like a web500 page. Is there a known bug when attempting to upload pdf's?   Just in case,here's the only relevant code attached to the control:   If uploadFilename.EndsWith(".rpt") = True Then 'ensures only .rp...

File Upload- Uploads a blank 90kb file
Hi, I'm uploading a 90kb file to both my oracle database and the internet server from 2.0 via fileupload tag.The file uploads correctly into oracle but uploads with the correct filename but with 0 bytes into my server. Has anyone come across this issue? My Code for saving into my server: Me.filMyFile.SaveAs(Server.MapPath("~/" & "zQ2_" & datever & _ Me.filMyFile.FileName.ToString()))         Please help me solve this issue.Thank YouVic Is the file being created with zero byte?ASP.NET Hosting (HostingFest) Yes, the file uplo...

how to get a url of a file with file upload
i want to store the url of a file in database where user uses the fileuplaod to select the file Then  the url of the file that is chosen should be stored in database i don't know how t odo this Can the above be done in this way or is there another way for the solution,Anas Ghanem.Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF ...

File uploading
Hi, How do i get the file size when a user uploads a file? i can now get the filename and it uploads the file to my server correctly, but i'm unable to get the file size of the file... These are the codes i used... fn = System.IO.Path.GetFileName(FileField.PostedFile.FileName) fs = FileField.PostedFile.ContentLength Even these set of codes also won't work... fn = System.IO.Path.GetFileName(FileField.PostedFile.FileName) fs = System.IO.Path.GetFileName(FileField.PostedFile.ContentLength) The error that i get when i added the 2nd line of code to get the ...

Get file name of uploaded file
Hello,  Is there a way to grab the full name of the file that is being uploaded?  The software automatically changes it when uploading. Thanks, Michael Michael,If you are using the FileUpload control you can use the PostedFile.FileName property.  If you need just the name and not the path, you can use Path.GetFileName(fileControl.PostedFile.FileName) Is this what you are looking for? ~Ben Thanks Ben, but have you ever looked at the Classified Starter kit?  It does not use the FileUpload control. Michael,I have not. What is the control that it is using? Is it...

How to get file extension of uploaded file
Heres a simlpe one. How do i get the file extension of an uploaded file or any file for that matter without using any of the substring or split functions. I thought File.PostedFile would contain a property like that but it was not to be. Thanks in advance. As far as I know, the only way to get the extension is to parse it out...out of curiosity, why do you not want to use any of the string methods for parsing? Chris I totally agree with the previous response but thought I would add a few other options which *may* help, depending if they are usable in your situation. (Without additi...

File Upload How to get the path of the file
Hello to Everybody,The situation is the following I am using a Form to send a email with attachment that I get name from FileUpload Control, after I create a button that transfer the Path and name of the File but only transfer the File Name and the path are not included.Somebody can help me on how to get the path  from the control FileUpload    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click        txtAttachmentPath.Text = FileUpload1.FileName    End Sub Thanks ev...

File Upload
I use 2.0 with VS 2008 In my code I have put a file upload limit of 1 MB. But if I try uploading files greater than 4 MB, instead of showing the User Message, it does not execute any line of code. Instead it shows. Internet Explorer cannot display the webpage But if I try uploading files between 1MB+ and -4MB, it shows the user message correctly. Cant seem to figure out what the problem could be. Any hints? Below is my codeDim path As String = Server.MapPath("~/UploadedFiles/") Dim fileOK As Boolean = False If FileUpload1.HasFile Then If FileUpload1.PostedFi...

Web resources about - File Upload - how to identify which user uploaded which files?? -

Stop and identify statutes - Wikipedia, the free encyclopedia
to detain persons and request such persons to identify themselves, and arrest them if they do not. The authority to detain on reasonable suspicion ...

New Louisiana Law: Sex Offenders Must Identify As Such On Facebook
A new Louisiana law aimed at sex offenders mandates that they must identify their criminal status on Facebook and other social media sites. The ...

Facebook launches verified pages and profiles to help users identify authentic accounts
Facebook today announced the launch of verified pages and profiles, which will make it easier for users to find official fan pages and accounts ...

Feds identify 2 killed in New Mexico plane crash - KRQE News 13
The U.S. Department of Agriculture says a pilot with the Wildlife Services program and a state wildlife specialist died when their plane cra… ...

Missed opportunities to identify high value Customers - Virgin Atlantic case study
... you can get. I really fly a lot! On my briefcase and all my bags I have the Delta Diamond tags. This is like Missed opportunities to identify ...

Identify Things on the App Store on iTunes
Get Identify Things on the App Store. See screenshots and ratings, and read customer reviews.

After Paris Attack Fox Anchor Shannon Bream Suggests Skin Color Can Help Identify Typical Bad Guys ...
Fox News anchor and Supreme Court correspondent Shannon Bream reacted to a Paris terror attack by suggesting certain skin tones are more typical ...

Dubai Police in appeal to identify dead man - The National
Dubai Police have appealed to the public to try to identify a man whose body was found recently.

Burnt beach towel may help identify decapitated man
A burnt beach towel may help identify a man whose charred body was found decapitated and dismembered north of Brisbane last month.

Minister for women doesn't have to identify as feminist, says Senator Michaelia Cash
The federal minister responsible for women says it is &quot;ridiculous&quot; that identifying as a feminist should be a prerequisite for her ...

Resources last updated: 12/14/2015 4:50:23 AM