Click here to Skip to main content
15,914,820 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have one requirement in asp.net i.e. From File upload control we have to select any type of attachment(.doc,pdf,.jpeg......) then we have to convert into sql server image data type then we have to save in SQL Server database.

Please help!!!

Thanks,
Codehub.
Posted
Updated 27-Dec-13 22:12pm
v2

You can't convert "any type of attachment" to an image - you need an attachment type that you can read and process into an image, which means having an application that can cope with the data format as a minimum. For example, if the client uploads a Word file your server must have Word (or a similar program) that can read the file in order to understand it - and that program must have the facility to produce an image from the document. Not all do.

Most of the time, what the user uploads is irrelevant: just store it in SQL (or in a file and store the path in SQL) and allow him to download it again. Think about it: if he uploads a 2 hour video file, which frame should you use for the image if you generate it?
 
Share this answer
 
you cannot change file into image but to save in SQL you could convert the file into string and then save it. See the below link
http://stackoverflow.com/questions/6850850/reading-file-content-to-string[^]
 
Share this answer
 

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