asp.net - File uploading : What should be the name of the file to save to? -


I am going to add file upload control to my ASP.NET 2.0 web page so that users can upload files. The files will be stored in the folder in the name of the server as the user. I want to know what is the best option for nameing files while saving the server. Security, execution, flexibility etc need to be considered to handle files. If I miss something, please direct me

The options which I am now considering:

  1. Upload an input filename with the same name
  2. Add User ID + Random Number + Name of File as Input File Name
  3. Create the current time in random number + seconds and save the file with that number. Will there be a table with users who upload this number

Anything else? What is the best way?

Thank you in advance

Username for user names Do not use user ID instead (I believe your users have a unique ID).

Never use the original file name. Use your solution number 3, instead of user name, user id

For your information, PHP was a vulnerability a few years ago: can make an HTTP post request with a file upload, and file name such as "../../anything.php", and The php _FILES array, which is to include a synthetic value, did not detect these types of file names, so any file could write files anywhere in the system.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -