0

I have ckeditor and ckfinder in admin folder.set config.ascx BaseUrl = "~/images/"; and ckeditor control as:

<CKEditor:CKEditorControl ID="CKEditor1" BasePath="/ckeditor/" runat="server" 
            Width="98%" Height="300px" EnableTheming="True" 
            EnableViewState="False" ViewStateMode="Disabled" ></CKEditor:CKEditorControl>

and set js like this:

 <script type="text/javascript">
     $(document).ready(function () {
         $('#CKEditor1').ckeditor();
     });
    </script>
  <script type="text/javascript">
   //<![CDATA[

   CKEDITOR.replace('CKEditor1', 
    {
      filebrowserBrowseUrl: 'ckfinder/ckfinder.html',
      filebrowserImageBrowseUrl: 'ckfinder/ckfinder.html?type=Images',
      filebrowserFlashBrowseUrl: 'ckfinder/ckfinder.html?type=Flash',
     filebrowserUploadUrl:
       'ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files&currentFolder=/images/',
     filebrowserImageUploadUrl:
       'ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images&currentFolder=/images/',
     filebrowserFlashUploadUrl: 'ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash'
    });

   //]]>
    </script>

and the code file:

  protected override void OnLoad(EventArgs e)
{
    CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();
    _FileBrowser.BasePath = "/ckfinder/";
    _FileBrowser.SetupCKEditor(CKEditor1);
}

but when I upload picture the error "the uploaded file is corrupt' is appear.

Somy J
  • 173
  • 1
  • 3
  • 22
  • 1
    1. Make sure that the standalone CKFinder sample works for you before you integrate it with CKEditor. Does the standalone sample work fine? 2. Check http://docs.cksource.com/CKFinder_2.x/Developers_Guide/ASP.NET/Troubleshooting and post your findings here – Wiktor Walc Aug 11 '15 at 08:08
  • @Wiktor Walc the standalone page has the same error and at debug mode the ' if ( oFile != null )' has null value and goes to 'catch ( ConnectorException connectorException ) { iErrorNumber = connectorException.Number; }' – Somy J Aug 11 '15 at 08:59
  • Are you sure that you set correct permissions to the folder you are trying to upload files? Try uploading a small text file first. – Wiktor Walc Aug 11 '15 at 10:21
  • @Wiktor I want to upload images and I'm testing in localhost. – Somy J Aug 11 '15 at 10:30
  • 1
    But to debug the issue you should start with the simplest scenario. Uploading images requires e..g the server to accept large files, while uploading a small text/zip file will at least answer the question whether the size of the file makes the difference. If even small text file fails, then it's most likely a permission issue. You can confirm the latter by trying to create a folder in CKFinder. If you cannot even create a folder, then you have the answer in your hands. – Wiktor Walc Aug 11 '15 at 10:45
  • @Wiktor, I tried to upload a small txt file but the same error. – Somy J Aug 11 '15 at 11:02
  • First try setting BaseDir manually in config.ascx to a proper server path to the directory where the target "userfiles" should be located (to which you should set proper permissions on IIS). It may be that resolving automatically the "server side" path, based on URL (BaseUrl) failed and this is the reason. – Wiktor Walc Aug 11 '15 at 11:22
  • @Wektor how should I set the BaseDir. is "~/images/" is correct? – Somy J Aug 11 '15 at 12:22
  • Nope, for BaseDir property setting value like "~/images/" would be incorrect. Make sure it starts with partition letter, e.g. "C:/" see http://docs.cksource.com/CKFinder_2.x/Developers_Guide/ASP.NET/Configuration/Quick_Start#Base_URL_and_Directory for examples of BaseUrl and BaseDir – Wiktor Walc Aug 11 '15 at 12:32
  • @Wektor I set it, but the same error. I use this files and refferencess at an older website .net 4.0 and it works, but at this vs 2013 .net 4.5 doesn't work. should I set anything at we.config. any way thank you for helps. – Somy J Aug 11 '15 at 12:40
  • "Make the user files folder writable for the Internet user. On Windows systems, give write permissions to the IUSR_ user." - did you check it and you are absolutely sure CKFinder has permissions to the folder where you try to upload files. – Wiktor Walc Aug 11 '15 at 12:45
  • @Wiktor it has the permission. I created a new website with .net 4.0 and used the files and assemblies and every thing works perfect. and another new website with .net 4.5 and the same file and folders and gives the error. – Somy J Aug 11 '15 at 13:22
  • Humm. I will ask one of our devs to check it. – Wiktor Walc Aug 11 '15 at 14:48
  • @Wiktor: when use asp.net 4.5 empty web from site, there will appear no problem. but when it has asp.net folders, it have error. maybe some of assemblies in bin directory make this. any way thank you. I solved my problem with a new empty .net 4.5 web form site and pasted my files there and it works now. thank you. – Somy J Aug 11 '15 at 17:02
  • Great to hear the issue is resolved, thanks! – Wiktor Walc Aug 11 '15 at 19:16

0 Answers0