Live Support, Chat, Upload Control and Rich Text Editor
Welcome to Support forums Sign in | Join | Help |Client Center
in Search

How to store attachments in SQL Database

Last post 07-10-2007, 9:10 AM by Kai2. 18 replies.
Sort Posts: Previous Next
  •  06-05-2007, 9:19 AM 30390

    How to store attachments in SQL Database

    Hi all,

    I want to store uploaded images and files in the SQL database instead of the local filesystem. I found the HowTo including the SQL-SourceCode but I did not find any documentation about it. Where could I find any description How to store in the SQL database?
    Thanks in advance!


    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
    Filed under:
  •  06-05-2007, 10:17 AM 30391 in reply to 30390

    Re: How to store attachments in SQL Database

    You can download the source for a SQL Server based filesystem from: HTTP://cutesoft.net/download/CustomFileProvider.zip
     
    It works very well.
     
    One problem that I am having - I had to switch to a common DB access component on the server that supports user authentication etc. I replaced all of the local SQL reader calls to call the server and return the results in the same format as the reader.
     
    Everything works except the images will not show up in the directory listing. The array of FileItems appears to be exactly the same, but when I break in the code - the cute editor does not fetch the images to show. It works fine with the original code - any idea what I might be missing? When I click on the images I can download them and they import into the editor fine.
     
    Thanks for any help.
  •  06-06-2007, 3:33 AM 30421 in reply to 30391

    Re: How to store attachments in SQL Database

    Hi Mike,

    thanks for your reply. Unfortunately your link does not help me as it is on the same page that I already linked in the initial post. I am aware that this works fine, but I have an existing web application which uses currently local file system to store attachments. Now I need to switch to store the attachments (only new, not necessary the existing ones) within the SQL database and therefore I am looking for a manual / tutorial which explains what steps need to be done to move the storage.....


    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
    Filed under:
  •  06-11-2007, 6:51 AM 30563 in reply to 30421

    Re: How to store attachments in SQL Database

    The missing responses mean there is no description available? :-(

    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
  •  06-11-2007, 12:59 PM 30580 in reply to 30391

    Re: How to store attachments in SQL Database

    MikeB1:
    You can download the source for a SQL Server based filesystem from: HTTP://cutesoft.net/download/CustomFileProvider.zip
     
    It works very well.
     
    One problem that I am having - I had to switch to a common DB access component on the server that supports user authentication etc. I replaced all of the local SQL reader calls to call the server and return the results in the same format as the reader.
     
    Everything works except the images will not show up in the directory listing. The array of FileItems appears to be exactly the same, but when I break in the code - the cute editor does not fetch the images to show. It works fine with the original code - any idea what I might be missing? When I click on the images I can download them and they import into the editor fine.
     
    Thanks for any help.
     
    MikeB1,
     
    If you are using version 6.0, please download the latest build of Cute Editor and this file provider.
     
    Keep me posted
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  06-11-2007, 1:05 PM 30581 in reply to 30421

    Re: How to store attachments in SQL Database

    Kai2:
    Hi Mike,

    thanks for your reply. Unfortunately your link does not help me as it is on the same page that I already linked in the initial post. I am aware that this works fine, but I have an existing web application which uses currently local file system to store attachments. Now I need to switch to store the attachments (only new, not necessary the existing ones) within the SQL database and therefore I am looking for a manual / tutorial which explains what steps need to be done to move the storage.....

     
    Kai2,
     
    Are you able to implement the following example on your site?
     
     
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  06-12-2007, 2:07 AM 30612 in reply to 30581

    Re: How to store attachments in SQL Database

    Hi Adam,

    yes, I've added it to my local inetpub and I could start the application.
    Image Hosted by ImageShack.us
    But I don't know what needs to be done to use it in my existing project.
    1. The example is in C# but I guess I could just translate it with the C#Translator to VB.net.
    2. The example is in .net 1.1 but my project uses .net 2.0. Is there any update necessary?
    3. The file 'fsitems.sql' seems to contain the procedures for setting up the SQL Tables. I'm not an SQL Expert and so I don't know how I could create the link between the attachment-table and my existing datatables.
    4. I guess the example uses the Save-Button from the Editor as there is no explicit Save-Button anywhere else on the page. Is there anything to modify when I use a explicit Save-Button?
    These are just some of the questions I currently have. A tutorial would be really nice, otherwise we also might clarify the questions via this forum if you like to. Many thanks for your support!

    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
  •  06-13-2007, 11:11 AM 30675 in reply to 30612

    Re: How to store attachments in SQL Database

    >>The example is in C# but I guess I could just translate it with the C#Translator to VB.net.
     
    Yes.
    >>The example is in .net 1.1 but my project uses .net 2.0. Is there any update necessary?
     
    Yes. Download the lastet build of Cute Editor in the following link:
     
     
    And use the DLL and client files for asp.net 2.0 framework.
     
    >>The file 'fsitems.sql' seems to contain the procedures for setting up the SQL Tables. I'm not an SQL Expert and so I don't know how I could create the link between the attachment-table and my existing datatables.
     
    Yes. 'fsitems.sql' contains a SQL Script to help you create a table fsitems in your database.
     
    This table will store the images, flash, media files and document files in your database.
     
    You can use SQL Query Analyzer of SQL Server Enterprise manager run it against your database.
     
    >>I guess the example uses the Save-Button from the Editor as there is no explicit Save-Button anywhere
     
    You can add a submit button anywhere in the page. Please check the examples included in the download package.
     
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  06-14-2007, 10:17 AM 30737 in reply to 30675

    Re: How to store attachments in SQL Database

    Hi Adam,

    I'm getting closer....

    I've now translated  SQLFileStorage to VB with the translator. I got around 10 errors but fixed them (hope the fixes are all correct). I've created the SQL-Table with your script. When I start the application I could click on the PDF-Icon to upload a file. When I selected a file I got an error "Access is Denied to C:\Windows\Temp".


     After granting Full Access for "Everyone" on C:\Windows\Temp I could upload files.



    1. I need to give access for Account "Everyone" to C:\Windows\Temp. Where is this directory defined? Additionally using just the asp.net Machine account in the Windows Security list does not help, it needs to be "Everyone". In my application I have impersonation = True, but shouldn't I then access the directory with my account? I of course do already have full access to C:\Windows\Temp on my local machine (currently I'm working with local IIS).
    2. Image Preview in the Selection Window does not work anymore. The right window is always empty.

    3. When I try to embed an image I only get the red cross (like no icon available). After saving the document the 'noting'-icon also disappears.
    4. When I select an uploaded file to be attached to the editor (using the PDF-icon) the file path is displayed. This seems to be correct, but  when I click on the link after saving the link just disappears.....? Sounds strange, but that's true. Tested several times. Then I close the document and re-open it. When I then click on the link again my application crashes with "Microsoft JScript runtime error: Permission denied". When I then stop my application and start it again it's the same behavior (1st click: link disappears, 2nd click: Application crashes)


    Here is the file I used (replaced the connection string with the default)
    http://cutesoft.net/forum_uploads/SqlFileStorage.zip

    Additionally this is in my Page Load Event (Editor Control is called "Description")
    With Description
                .Setting("CuteEditorFileStorageType") = GetType(SqlFileStorage).AssemblyQualifiedName
                .Setting("DownFile") = ResolveUrl("DownFile.Aspx")
                .SetSecurityGalleryPath("/")
            End With

    Many thanks in advance for your support Adam!!



    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
  •  06-14-2007, 9:39 PM 30771 in reply to 30737

    Re: How to store attachments in SQL Database

  •  06-15-2007, 1:59 AM 30773 in reply to 30771

    Re: How to store attachments in SQL Database

    Just checked the file I downloaded. It'S "CuteEditor_for_NET6" together with .net 2.0. The "Framework 2.0"-Folder within the downloaded zip is from 10.April 2007 19:39.
    I've now also added it to my signature I case there are further posts in other threads.

    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
  •  06-20-2007, 6:09 AM 30912 in reply to 30771

    Re: How to store attachments in SQL Database

    Hi Adam,

    any ideas? Thanks!


    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
  •  06-25-2007, 12:58 AM 31034 in reply to 30912

    Re: How to store attachments in SQL Database

    Hi all,

    as no replies found here I checked the code on my own. I found that the translator from c# to vb.net caused the problems. After playing around with the downfile.aspx.vb I found a configuration where opening uploaded documents works fine! :-) If anyone is interested here is my current DownFile.aspx.vb.

    So as a wrap up regarding my previous posting 30737

    1. Is it possible to avoid giving access to C:\Windows\Temp for Everyone? No problem on my local machine, but on the server I would like to avoid it.
    2. Image Preview works fine now.
    3. Embedding images works fine now.
    4. This problem does not appear anymore but there is still a problem with my application crashing some times with "Permission denied". I'll open a seperate thread as soon as I got some more details about it.
    Kind regards
    Kai

    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
  •  06-25-2007, 9:22 AM 31046 in reply to 31034

    Re: How to store attachments in SQL Database

    >>Is it possible to avoid giving access to C:\Windows\Temp for Everyone? No problem on my local machine,
     
    This issue should be resolved in version 6.0.
     
    Anyway, please try the steps below.
     
    1. Create a folder under your project and name it "CuteEditorTemp"; make sure ASPNET account has write permission to the above folder.
     
    2. Open your web.config and add the following entry:
     
    <add key="CuteEditorTempPath" value="~/CuteEditorTemp" />
     
    >>Image Preview works fine now.
     
    Good.
     
    >>Embedding images works fine now.
     
    Good.
     
    >>This problem does not appear anymore but there is still a problem with my application crashing some times with "Permission denied".
     
    Keep me posted with this issue.
     
     
     
     
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  06-25-2007, 9:45 AM 31051 in reply to 31046

    Re: How to store attachments in SQL Database

    Hi Adam,

    thanks for your help. Unfortunately it's still the same error, Access denied to C:\Windows\Temp. Seems CE did not recognize my new settings in web.config. (I've added <add key="CuteEditorTempPath" value="~/CuteEditorTemp" /> to the AppSettings-Section).

    Additionally sometimes I get an "Unknown Error - maybe the file is too large!". I tried to upload a 5 MB exe-File. I have a 10 MB limit and exe is allowed (otherwise I got the unallowed file error message). This error also appeared before so it has nothing to do with the access denied error.

    Within the project I've migrated from 5.2 to 6.0, maybe there is still some old config somewhere?


    Thanks
    Kai


    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
  •  07-03-2007, 3:18 AM 31224 in reply to 31051

    Re: How to store attachments in SQL Database

    Hi Adam,

    just tried again: As soon as I take away access rights of "Everyone" for "C:\Windows\Temp" I get the above mentioned error ("Access to the path "C:\Windows\Temp" is denied"). I've added this line in my web.config appSettings
    <add key="CuteEditorTempPath" value="~/CuteEditorTemp" />


    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
  •  07-03-2007, 10:27 AM 31239 in reply to 31051

    Re: How to store attachments in SQL Database

    Kai2:
    Hi Adam,

    thanks for your help. Unfortunately it's still the same error, Access denied to C:\Windows\Temp. Seems CE did not recognize my new settings in web.config. (I've added <add key="CuteEditorTempPath" value="~/CuteEditorTemp" /> to the AppSettings-Section).

    Additionally sometimes I get an "Unknown Error - maybe the file is too large!". I tried to upload a 5 MB exe-File. I have a 10 MB limit and exe is allowed (otherwise I got the unallowed file error message). This error also appeared before so it has nothing to do with the access denied error.

    Within the project I've migrated from 5.2 to 6.0, maybe there is still some old config somewhere?


    Thanks
    Kai

     
    Kai,
     
    You can set up Web.config to allow uploading of large files by ASP .NET applications.

    By default, Machine.config is configured to accept HTTP Requests upto 4096 KB (4 MB) and it is reflected in all your ASP.NET applications. You can change the Machine.config file directly, or you can change only the Web.config file of the application(s) you want to.


    Open your Web.config file, and just below the <system.web> tag, add the following tag:

    <httpRuntime
    executionTimeout="120"
    maxRequestLength="4096"
    useFullyQualifiedRedirectUrl="false"
    minFreeThreads="8"
    minLocalRequestFreeThreads="4"
    appRequestQueueLimit="100"
    enableVersionHeader="true"
    />

    Now, just take a look at the maxRequestLength="4096" attribute of the <httpRuntime> tag. As you may have realized, all you need to do is change the value to some other value of your choice (8192 for 8 Mb, 16384 for 16 Mb, 65536 for 64 Mb, and so on...).
     
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-04-2007, 2:03 AM 31261 in reply to 31239

    Re: How to store attachments in SQL Database

    Hi Adam,

    thanks for the snippet, that fixed it. I've successfully uploaded a 8 MB attachment. Thanks!

    So now the only problem is the access for "Everyone" to C:\Windows\Temp. Do you also have any idea for that?

    Many thanks
    Kai


    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
  •  07-10-2007, 9:10 AM 31438 in reply to 31261

    Re: How to store attachments in SQL Database

    Hi all,

    last week we put the application to our test server and there it's the same result. Any ideas?

    Thanks
    Kai


    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
View as RSS news feed in XML
Powered by ASP.Net
Copyright 2003 - 2017 CuteSoft Components Inc.. All rights reserved.