Saving Uploaded file to database dirctly

Thread is closed for posting
5 posts, 0 answers
  1. o
    o avatar
    20 posts
    Member since:
    Jan 2008

    Posted 04 Jun 2011 Link to this post

    Hi all,

    hop any one can help me,

    i am using the following coding to upload files to the sqlserver dirctly no need to save, but i get error on line 

    foreach (UploadedFile file in UFile.UploadedFiles)

     {
    byte[] imgbytes = new byte

    [file.InputStream.Length]; // I get error on this line, can any one help me, it dos not accept this line. file.InputStream.Read(imgbytes, 0, file.InputStream.Length);

     

     try

     

     {

     

    DB.Image("insert into projectsimages (image,id) values(@picture,'1')"

    , imgbytes);

     

     

     

    }

     

     

     

     

  2. o
    o avatar
    20 posts
    Member since:
    Jan 2008

    Posted 04 Jun 2011 Link to this post

    Hi all,

    I just solved it, i just need to add the following

     

     

     

    file.InputStream.Read(imgbytes, 0, (int)file.InputStream.Length);


    Thanks

     

     

     

     

     

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 29 Jun 2011 Link to this post

    Hello Omar,


    what's DB , where you declare it

    Thanks,
    Mohamed.
  5. o
    o avatar
    20 posts
    Member since:
    Jan 2008

    Posted 02 Jul 2011 Link to this post

    Hi Mohamed,
    Sorry for late replay,

    DB is Class Lib that i created to be used in all my projects so its not somtehing that comes with Telerik or VS.

    Regards
    Omar
  6. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 04 Jul 2011 Link to this post

    Thanks for ur reply Omar,


    Regards,
    Mohideen.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017