Click here to Skip to main content
15,176,823 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All,
I want to upload my Images and Videos on Live Server in asp.net ,
but i dont want to used varbinary
Please help me out


Thanks

What I have tried:

I tried that varbinary but its take too much time to save and fetch..
is there any easy way to save and search images...
Posted
Updated 17-Aug-21 2:26am
Comments
Richard MacCutchan 17-Aug-21 7:01am
   
Since all files are just streams of binary data you do not have much choice.

Don't store files in the database. Store the files in the file system, and store the path of the file in the database.

If you absolutely must store files in the database, use a FileStream or FileTable:
FILESTREAM (SQL Server) - SQL Server | Microsoft Docs[^]
FileTables (SQL Server) - SQL Server | Microsoft Docs[^]
   
Images and videos are streams of bytes: so the only available SQL storage type is VARBINARY, so if it's giving you a problem, then you need to look for a better approach.

And to be honest, the whole idea of video storage in an SQL database is a poor idea from so many, many aspects that it's hard to see any good points at all other than "I know how to do that".
Pictures are generally quite large and videos? Huge. Loads of bandwidth needed to transfer them between any two parts of a system.

It is always going to be slow: you have the network traffic between the web server backend code and the SQL Server DB computer, the memory allocation on the DB server, the disk write on eth DB server, and probably the file allocation increase on the DB server to contend with just on writes.
On read, you have memory allocation on the DB server, network traffic, memory allocation on the back end server, internet traffic to the browser, and memory allocation in the browser as well.

You want a better idea?
Store the video data as a file in a folder the back end code can access, and store the path to the file in SQL.
You can then stream directly from the file to the browser and avoid 90% of the bottle necks...
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900