How can I upload a file using Ruby on Rails to SQL Server 2008?
-
I need to specifically upload the file to be placed in a varbinary(max) column. Hypothetically, a user picks a file from their hard drive and then it is placed in the upload form. Upon submission, the file should be placed in the varbinary(max) column seeing it is a binary file. I cannot use paperclip, carrierwave, or attachment_fu.
-
Answer:
Have you looked into SQL Server's FileStream for managing BLOB storage?
Shannon Moreland LeVert at Quora Visit the source
Other answers
what you're asking is just a regular insert. so let's say you have a table named MyFileTable you would run: INSERT MyFileTable(FileColumn) VALUES(@FileContent)
Mordechai Danielov
Don't! Regardless of Web framework or database brand do not use a relational database as a file storage. I rarely see any good justification to do so. Avoid storing in the file system as well if you ever intend to horizontally scale your system. If you're restricted by draconian corporate policies, there's no much of an option, I know. If you have doubts, choose a 3rd party solution in the cloud. I recommend Cloudinary.
Fabio Akita
Related Q & A:
- Can I create a second filestream container on an existing SQL Server 2008 database without going offline?Best solution by Database Administrators
- How can I send a file to a friend on Hotmail?Best solution by askdavetaylor.com
- How can I upload a video on yahoo 360?Best solution by Yahoo! Answers
- How can I attach a file greater than 25mb?Best solution by Yahoo! Answers
- How can I upload a profile picture on yahoo?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.