Good day! As you know, a kind of tables appeared in sql server - file tables, File tables. I have an asp.net mvc web application that uses sql server 2012 database. Some text articles are stored in the database. The articles use many links to images that are stored in the file system. The problem is that when backing up the database and then deploying the backup, you must also take care of archiving and subsequent unarchiving of all images (links to which, as I said, are stored in the database). It is here that I would like to apply this very FileTable technology so that the images themselves are still stored in the file system, but at the same time the sql server would “know” about them through FileTable. In the end, I started such a table, added my own files to it, but now I don’t know how to access them from a web application, so that it looks the same as a call to regular files. I can open the storage location of these files from the sql server management studio interface (right click on my file table, select the Explore FileTable Directory item), I see all my files there, but I don’t know how to use them. Suppose I want to put an image from this folder on a web page. What do you need to write to the img tag? Previously, it was like this:
<img src='/images/mypicture.png' /> Now I tried this:
<img src='\\sql-server-name\mssqlserver\MyFiles\mypicture.png' /> Unfortunately it did not give a result.
I wish that I could still refer to these images in the same way (that is, that the images themselves did not move anywhere), but at the same time that my database had a file table that would refer to this folder. Maybe I somehow looked inattentively, but when I tried to reproduce it, I did not succeed.
selectquery to output data from a file, while the table itself stores only the file ID, and the server then loads the data from where. Therefore, in your case, the extraction of images should be done using a script, so Thesrcattribute should have a link to the php code that extracts the file from the database and send them to the client with the necessaryheaderheaders. - teran/images/mypicture.pngmatch the physical location of the file. To do this, for example, in IIS, configure a virtual directory (match/imageswith\\sql-server-name\mssqlserver\MyFiles). Or, as you have been advised, in the application add a controller, the action of which will give the desired file. - i-one