Does .net SQL Server suuport KFM for TinyMCE?

Hey,

I want to use KFM which is a plugin i wish to incorporate for TinyMCE, but just want to make sure i can use it with an SQL Server database???

In the “configuration.dist” file, this snippet of lines-


// what type of database to use
// values allowed: mysql, pgsql, sqlite, sqlitepdo
$kfm_db_type = 'mysql';

// the following options should only be filled if you are not using sqlite/sqlitepdo as the database
$kfm_db_prefix   = 'c2_';
$kfm_db_host     = 'locahost';
$kfm_db_name     = 'dbname';
$kfm_db_username = 'username';
$kfm_db_password = 'password';
$kfm_db_port     = '';

It shows which databases i can use…

Any ideas if i can use SQL Server ?

Thanks

Well that is PHP code, so you cannot use that. TinyMCE is just a javascript textbox, I use that with my .net sites all the time. Do not know about KFM tho

If you want to use MSSQL with PHP, you need to download the driver:

And a tutorial:

Hope it helps.

If that is ur question, then you should post in PHP section. But if you have a pre-existing solution and wana change it to mssql, you will need to change all references to mysql, not just the connection parameters

Hey,

Well forget the above question, my question should have been, is there anything i can use to easily upload images with TinyMCE??

How can i use KFM with .net? If so, are there any tutorials?

Thanks :slight_smile:

Well, here’s what I do. I use a regular <asp:fileupload> control (in WebForms, MVC just uses <input type=“file”/>) to upload images to one folder and documents to another (it chooses the folder based on the file extension).

Then I use TinyMCE’s external_image_list_url to put images in the Image button in the TinyMCE control and external_link_list_url to put documents into the Anchor control.

This not only doesn’t employ extra plugins to maintain but it also seems to be much easier for the end user to understand.

edit - screenshot attached

I meant the “Link control” not the “Anchor control”. :slight_smile:

Hey,

I’m trying to incorporate a method to upload the images. See now i have a file upload control…


    <table cellspacing="8">
    <tr><td><asp:Label ID="Label25" runat="server" Text="Category:"></asp:Label></td><td>
        <asp:DropDownList ID="DropDownList1" runat="server" 
            DataSourceID="SqlDataSource1" DataTextField="cat_name" 
            DataValueField="cat_id">
        </asp:DropDownList>

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="Data Source=tcp:esql2k801.discountasp.net;Initial Catalog=SQL2008_673062_kids;User ID=SQL2008_673062_kids_user;Password=******;" 
            SelectCommand="SELECT [cat_id], [cat_name] FROM [tbl_article_cat]">
        </asp:SqlDataSource>

    </td></tr>
    <tr><td><asp:Label ID="Label10" runat="server" Text="Post name: "></asp:Label></td><td><asp:TextBox ID="txt_name" runat="server"></asp:TextBox></td></tr>
    <tr><td><asp:Label ID="Label8" runat="server" Text="Story details: "></asp:Label></td><td><asp:TextBox ID="txt_body" runat="server" TextMode="MultiLine"></asp:TextBox></td></tr>
    <tr><td></td><td><asp:FileUpload ID="FileUpload1" runat="server" /> &nbsp; <asp:Button ID="Button2" runat="server" Text="Upload" onclick="Button2_Click" /></td></tr>
    
    </table>
    
            <br />

    <asp:Button ID="Button1" runat="server" Text="Submit" onclick="Button1_Click" />

So “Button1” just does an insert so i wont show you that code. But what i am working with here is “Button2”. Code for this is show below:-


    protected void Button2_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            string filePath = HttpContext.Current.Server.MapPath("images") + "\\\\";
            Directory.CreateDirectory(filePath);
            FileUpload1.SaveAs(filePath + "\\\\" + FileUpload1.FileName.ToString());

            txt_body.Text += string.Format("<img src = '{0}' alt = '{1}' />", filePath, FileUpload1.FileName.ToString());
        }
    }

But this does not work, i get an error saying:-

There is not enough space on the disk.

And it points to this line:-


FileUpload1.SaveAs(filePath + "\\\\" + FileUpload1.FileName.ToString());

I dont understand why i get this error, as there is more than enough room on the server. I have tried uploading an image elsewhere and it works perfectly.

Any idea why i get this??

Thanks

hmmmm.

Ok, well there are a few things you need to change


if (FileUpload1.HasFile)
{
 string filePath = HttpContext.Current.Server.MapPath("/images") + "/";
 if (!Directory.Exists)
 {
            Directory.CreateDirectory(filePath);
 }
FileUpload1.SaveAs(filepath + FileUpload1.FileName.ToString());

 txt_body.Text += string.Format("<img src = '{0}' alt = '{1}' />", "/images/"+FileUpload1.FileName, FileUpload1.FileName.ToString());

}

That should work, just know that it is not a viable solution tho, as this will not work if you upload a file, with a filename that already exists. So Ideally what you want to do is write an upload method, like the one I posted a while ago in another thread of yours, that handles the uploading, renaming, etc and returns the new filename as a string.

Also, if you want it to be more ajaxy(lol) then you can google jQuery file upload. You can then upload files asynchronously.

Hey thanks for the code,

I am just trying this first so i can present something and set the site live, will go for a more robust approach a bit later on. (Maybe Ajaxy :-))

Anyway, i am getting errors with this code:-


        if (FileUpload1.HasFile)
        {
            string filePath = HttpContext.Current.Server.MapPath("/images") + "/";
            if (!Directory.Exists)
            {
                Directory.CreateDirectory(filePath);
            }

            FileUpload1.SaveAs(filepath + FileUpload1.FileName.ToString());

            txt_body.Text += string.Format("<img src = '{0}' alt = '{1}' />", "/images/" + FileUpload1.FileName, FileUpload1.FileName.ToString());
        }

I get this error:-

Operator ‘!’ cannot be applied to operand of type ‘method group’

Any ideas?

I believe Directory.Exists() requires something to test so you’re going to have to do something like Directory.Exists(filepath) and if the not operator (!) still gives you issues try wrapping it in parentheses

if(!(Directory.Exists(filepath))) {

Hey,

Thanks, that fixed the error, but when the code executes i get that error again saying:-

System.IO.IOException: There is not enough space on the disk.

Points to this line:-


FileUpload1.SaveAs(filePath + FileUpload1.FileName.ToString());

By the way,

Whilst i’m trying to get this fixed, what do you guys think of this alternative?

http://tinymce.moxiecode.com/plugins_imagemanager.php

I have to pay for it, but if it works i dont care :slight_smile:

Will this work exactly how i want it to?

Thanks

It looks like it will work, but I have never used it before. Do they not offer a trial version to see if it will suit your needs?

As for the error your have, out this: filePath + FileUpload1.FileName.ToString()

Either with response.write() or with a debug break point and see what the path is and make sure it is correct. Also make sure the internet guest account has the appropriate permissions



string filePath = HttpContext.Current.Request.MapPath("~\\Images");
FileUpload1.PostedFile.SaveAs(filePath + "\\" + FileUpload1.FileName.ToString());


[COLOR=“Navy”]
Notice the “PostedFile” property added…

[/COLOR]

LOL. Of course. Don’t now how I missed that one!