@Suryagniit Sir, We equally had a similar kind of requirement. Any kind of file could be uploaded (like pdf, image, image inside pdf, txt, doc, zip, etc.) . I agree that our major technologies were AngularJS, WebAPI, EF and SQL Server (among the others).
We modeled as under
public byte[] DocumentData { get; set; }
and the DB table structure was
CREATE TABLE [dbo].[tblLeadDocuments](
[LeadDocumentsId] [int] IDENTITY(1,1) NOT NULL,
[DocumentId] [int] NULL,
[DocumentData] [image] NULL,
[FileExtension] [varchar](5) NULL,
[DocumentStatusId] [int] NULL,
CONSTRAINT [PK_tblLeadDocuments] PRIMARY KEY CLUSTERED
(
[LeadDocumentsId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
As can be figure out
[DocumentData] type was [image] .
However, from the angular side we were converting the files to base64 and was passing to the byte array exposed by the WebAPI.
Also please note that [FileExtension] column was kept for storing the file extension. This comes handy at the time of converting the response satisfying the proper file identity. This was happening at the AngularJS side.
Hope this tip will be helpful along with the above mentioned responses.
Thanks.
--
Thanks & Regards,
RNA Team
Suryagniit, if this helps please login to Mark As Answer. | Alert Moderator