How can i store a doc or pdf file in SQL Server

This is a discussion on How can i store a doc or pdf file in SQL Server within the C# Programming forums, part of the General Programming Boards category; hi guys, on my project (working with c#-asp.net,SQL Server 2005) students upload their thesis to the system. i made the ...

  1. #1
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71

    Question How can i store a doc or pdf file in SQL Server

    hi guys,
    on my project (working with c#-asp.net,SQL Server 2005) students upload their thesis to the system. i made the uploading form, i used the fileupload component for taking the thesis.

    For now i used the image type for storing the thesis does it work?

    i am waiting your opinions, thanks...

  2. #2
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    Store it as binary data. Or store the path on some filesystem that you can retrieve from. IE upload it somewhere, and store this path for later retrieval.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    Agreed with Valaris. And specifically varbinary(max) if you're expecting files to be large.

  4. #4
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71
    thanks guys for your answers, i will made like valaris said, firstly i stored them somewhere then i will hold the path in database..

  5. #5
    Slime Dragoon_42's Avatar
    Join Date
    Feb 2003
    Location
    Vancouver
    Posts
    90

    Cool

    Bah! It's way more fun to store them in BLOBs in SQL. Give it a shot, it's not too difficult and then you're not relying on the file system maintaining it's structure.

  6. #6
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71
    firstly i wanted to store files in db, but after talking with my advisor he wants to store files in a folder in solution.

    student can upload his/her these to the folder (in theses folder in the solution) and the path of theses are holded in db. how can i download the these file from the system?

  7. #7
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    Quote Originally Posted by Aga^^ View Post
    firstly i wanted to store files in db, but after talking with my advisor he wants to store files in a folder in solution.

    student can upload his/her these to the folder (in theses folder in the solution) and the path of theses are holded in db. how can i download the these file from the system?
    You have the path in the database. So provide a link to it. I don't know what web language you're using, but its quite trivial.

  8. #8
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71
    thanks valaris , i also thought that but i implemented wrongly, after your comment i tried again and got it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. File Writing Problem
    By polskash in forum C Programming
    Replies: 3
    Last Post: 02-13-2009, 09:47 AM
  3. Totally confused on assigment using linked lists
    By Uchihanokonoha in forum C++ Programming
    Replies: 8
    Last Post: 01-05-2008, 03:49 PM
  4. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  5. Replies: 3
    Last Post: 03-04-2005, 01:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21