![]() |
|
||||||||||||||
|
The first step to creating a secure online data repository is to have the actual documents stored in a location that cannot be accessed by the public. Here are three very different approaches:
We will concentrate on how the private files are passed to the right users by following the first and second approaches above. If the file is stored in the database then files that are not tens of megabytes can be retrieved to the memory of your server application code and the file itself can be returned as the HTTP response. The user would then see the upload options appear in much the same way that you would see if you typed direct file reference into your browser's address bar. Your HTTP response will usually begin with the line "Content-type: text/html" and this can be changed to the appropriate message for the type of file being downloaded by the user, followed by the file contents. That is the end of the story for the first approach. For the second approach, in which the file is stored as a coded filename in the file system, you will still need a database table that holds information about all stored files. In particular you will need to know (1) the original physical filename and (2) the coded physical filename on the server. The hyperlink to download the file will not be a direct file reference but instead a reference to your web application with the instructions to perform the following:
The directory creation in step 2 prevents someone from continually attempting to download a URL using a known filename until someone permitted to download it 'opens the door'. The strength of this approach is that it is both secure and fast and can be used with very large files. The weakness is that you will need to add a strategy for deleting the temporary directories and files and ensure that they are not deleted while the user is still downloading. A reasonable approach is to simply run a delete routine every few hours.
Julian Cochran |
||||||||||||||
|
© DigitalScores 2025 |
|||||||||||||||