Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Storing videos and pdf into DB

Author  Topic 

sg2255551
Constraint Violating Yak Guru

274 Posts

Posted - 2007-01-02 : 03:14:54
hi

i am building an asp.net2.0 web app to manage my contents but there is one thing that i am not so sure yet and that is how to store videos and pdf and images in sql 2005? are there any good tutorials that you guys can lead me to? thanks

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2007-01-02 : 03:58:25
Quite similar to BLOB(s)

Do a search on BLOB lots of posts on it.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-01-02 : 04:20:06
Generally such things are better stored in the File System, rather than the Database - i.e. store the Path / Filename in the database, and the physical file in the File System.

See: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=Image,Images

Kristen
Go to Top of Page

sg2255551
Constraint Violating Yak Guru

274 Posts

Posted - 2007-01-02 : 04:33:16
hi

The reason i am stroing into DB is because i do not want them to download. hopefully i am right about this.thanks
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-01-02 : 05:18:53
The database issues still apply though - bloat size of the database, slower speed of access, huge backups, poor memory utilisation on database server, heavy traffic between database server and web server, more awkward programming to Store and Extract the Blobs and so on.

There are other ways of making files non-downloadable - e.g. having an ASP (or other) "program" that accesses the download files from OUTSIDE the WWW file area - so that the user has no rights to access the files directly. The ASP file can check that the user is entitled to the download - which is probably the same solution as with the media being physically in the database.

Its horses-for-courses but in all the circumstances I have come across I haven;t come across one yet where we would have wanted the files in the database.

Kristen
Go to Top of Page

sg2255551
Constraint Violating Yak Guru

274 Posts

Posted - 2007-01-02 : 05:28:59
hi

as you know, people still can right-click the link and choose Save Target As. do you have any good tutorial from preventing user to save into their PCs? thanks
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-01-02 : 05:45:45
"people still can right-click the link and choose Save Target As"

I don't think it makes any difference. If you put a link to the file (stored in your database) then anyone can click that, as they could for a link to something that delivered it from a file - something needs to check that the user is eligible for that file.

<a href="MyImageDownload.ASP?FileID=1234">Click Here</a>

launches MyImageDownload.ASP. It can check that the current session/user is permitted to download "FileID=1234" and if so streams the file to the user (with an appropriate Content Type). It would "get" the file from, say, x:\Secret\MyFile.PDF" and NOT from x:\INetPub\MySite\www\PublicFiles\MyFile.PDF - which WOULD be available for anyone who knew/guessed the URL

Otherwise it can just blow the user a raspberry!

<a href="Secret.PDF">Click Here</a>

would just deliver the file to anyone and everyone who asked for it of course, so you need something "else" to delivery the file, and not provide a direct URL to the file.

Kristen
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2007-01-02 : 05:55:57
one benefit of storing everything in the database is that your data and metadata are always in sync. This isn't always the case when you have the metadata in the database and the data located in a filesystem. Restoring that type of environment (documentum for example) is a bit of a pain because of this. Restoring sharepoint (all data in database) is also a PITA, but that is another story :)

As to the original question, if people can click your link and open your documents (pdf, video or otherwise), then they can surely save them to local disk. I am not sure what technical solution you will be able to come up with, becuase it can surely be easily circumvented by those that know what they are doing. With that in mind, you may want to consider a different solution to your problem.

I'm guessing that you have valuable documents that you want to make available, yet you don't want them freely downloaded. You might want to consider making the TOC and a brief excerpt of your PDF documents available and then a link if they are to be purchased (like gartner, amazon, and everyone else does). For the vids, you might want to make a low resolution video or excerpt available on youtube, yahoo video and/or google video with links to your site where the full vid can be purchased. You can also implement the evil DRM on your videos if you really want to piss your customers off :)



-ec
Go to Top of Page

sg2255551
Constraint Violating Yak Guru

274 Posts

Posted - 2007-01-02 : 06:22:20
hi

actually is the company's How To desktop solutions for end users meaning if a user for example want to change desktop resolution, then all that user have to do is to just click "How To Change Your Screen Resolution" link and then sit back and watch the video.Company's policy is to prevent users from downloading or Save As from links. thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-01-02 : 06:48:32

http://www.aspfaq.com/show.asp?id=2149

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-01-02 : 09:49:54
"Company's policy is to prevent users from downloading or Save As from links"

Doesn't make any difference whether the "file" is in the file system or the database. Its down to a) keeping the file outside the WWW folders / permissions and b) setting the right Doc Type / Caching / other Meta data.

"http://www.aspfaq.com/show.asp?id=2149"

I get "Service Unavailable" - so I guess whatever it is has the right security & permissions!!

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-01-03 : 08:23:52
<<
I get "Service Unavailable" - so I guess whatever it is has the right security & permissions!!
>>

Try it now

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-01-03 : 09:21:13
"Try it now"

Still unavailable ...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-01-04 : 08:05:23
quote:
Originally posted by Kristen

"Try it now"

Still unavailable ...


Same Answer.

Try it now

Otherwise

Do Wait
Until Server is available


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -