CkEditor 4 [error status: 500] After Uploading File to Server - .net-6.0

I am using Asp.NET Core 6 & CKEditor 4
When I click on send button to upload selected image from local path, file uploads successfully but after that error appears as follow:
HTTP error occurred during file upload (error status: 500).
I added extra directory to application root and used StaticFile like bellow:
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(
System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "FilesCKEditor")),
RequestPath = "/FilesCKEditor"
});
Everything is ok when uploading image to the server but return status never send to ckEditor image browser dialog.
Please help me.
Thank You All

Related

Cypress Javascript Automation: Getting 500 error when uploading using Cypress

I am trying to automate uploading a picture on a website. I can manually upload fine. But when I do it using Cypress and node module cypress-file-upload, I get 500 server error.
I have import 'cypress-file-upload'; in commands.js file. I have
Cypress.on('uncaught:exception', (err, runnable) => {
return false;
});
I get application threw an error if I do not have this exception code.
This is what my code looks like for upload
cy.fixture('settings.JPG').then(fileContent => {
cy.get('[id="xyz"]').attachFile({
fileContent: fileContent.toString(),
fileName: 'settings.JPG',
mimeType: 'image/png'
});
});
As I look at browser where cypress is running, I can see, file is being attached near the Choose file field. But as soon Cypress clicks on the submit button, it throws 500 error
If I go to Cypress view pane and click on the submit button, it throws 500 error again
But if I click on the choose file and select the same file and then click on Submit button, then I do not get 500 error and it works.
Can anyone point out why I am getting 500 error? and what can I do to get past this? Thanks a bunch in advance.
Try to replace your mimeType as a image/jpg.

How to upload file in cypress test? once we select file in file open explorer then DOM directly uploading the file

There is a button in UI, it will open file open explorer, once we select file and click open, then DOM directly uploading the file,
Upload Document Pop Up
selecting the file and click open
file directly getting uploaded
tried all possible ways suggested in cypress-file-upload package. not working,
background there is an API POST request which is actually uploading the file, but that API URL is dynamic(URL includes the user authentication login token, and upload key, and user id), so it is not possible to generate/recreate the upload API URL
Can't able to access the file open explorer? In this scenario, how to perform file upload using CyPress?
You should be able to use a RegEx in the RouteMatcher for the intercept on the Upload API. If you need help creating your Regex, I suggest using Regex101 as a scratch pad. Slightly modified from the cypress-file-upload documentation:
// intercept the API endpoint
cy.intercept({
method: 'POST',
url: /.*my-api.com.*/
}).as('upload');
const fileName = 'upload_1.xlsx';
cy.fixture(fileName, 'binary')
.then(Cypress.Blob.binaryStringToBlob)
.then(fileContent => {
cy.get('#input_upload_file').attachFile({
fileContent,
fileName,
mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
encoding:'utf8',
lastModified: new Date().getTime()
})
})
// wait for the 'my-api.com' request, and leave a 2 minutes delay before throwing an error
cy.wait('#upload', { requestTimeout: 120000 });

CkEditor5 and CKFinder

Really basic question I hope.
I keep getting a 'no upload adapter' error message in the console when I try to add an image using CKeditor 5 - Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-filerepository-no-upload-adapter
Below are the instructions from the documentation.
Configuring the image upload only
This feature can upload images automatically to the server (e.g. when the image is dropped into the content) thanks to the CKFinder upload adapter. All it requires is the correct config.ckfinder.uploadUrl path.
Assuming that the CKFinder PHP server-side connector is installed (available) under https://example.com/ckfinder/, use the following quick upload command URL to enable the image upload:
import CKFinder from '#ckeditor/ckeditor5-ckfinder/src/ckfinder';
ClassicEditor
.create( document.querySelector( '#editor' ), {
plugins: [ CKFinder, ... ],
// Enable the "Insert image" button in the toolbar.
toolbar: [ 'uploadImage', ... ],
ckfinder: {
// Upload the images to the server using the CKFinder QuickUpload command.
uploadUrl: 'https://example.com/ckfinder/core/connector/php/connector.php? command=QuickUpload&type=Images&responseType=json'
}
} )
.then( ... )
.catch( ... );
I have added the above code onto the webpage where my editor exists within tags. Am I doing this wrong? Should this code be added somewhere else, within the config file somewhere else I am missing?
Link to the documentation in question - https://ckeditor.com/docs/ckeditor5/latest/features/image-upload/ckfinder.html
The uploader works fine if I go to the sample page - http://example.com/ckfinder/samples/full-page-open.html
Didn't get this working, so used https://github.com/ckfinder/ckfinder-laravel-package instead.

CKFinder - 404 Error when attempting an upload

I set my CKFinder/CKEditor integration as follows:
var editor = CKEDITOR.replace('editor11');
CKFinder.setupCKEditor(editor, null, { type: 'Files', currentFolder: '/archive/' });
The CKFinder popup displays and I go to the upload tab and am able to select an image. When I click "Send it to the Server" I get the following error:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make sure that
it is spelled correctly.
Requested URL: /ckfinder/connector
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.7.2110.0
I get a similar error when I click "Browse Server" on the Image Info tab. I see nothing else in the documentation that is required. Please help me to solve this issue
Edit:
Adding connectorPath fixed it. The path is different on our DEV server than my local machine, where it works already.
CKFinder.setupCKEditor(editor, {
connectorPath: '/brainsbeta/ckfinder/connector'
});

I can't add items from any dashboard (old or new)

I'm trying tu turn on and test ScadaLTS on my PC (Windows 10). Before read install instuctions, I have donwloaded and installed Tomcat and MySQL, configured context.xml and env.properties. I have restarted Tomcat before changes and navigated to localhost. All seems to work well. Login pagin is showed and I can log in with 'admin/admin'. I click on add view and new view is created. I go to edit button. When I try to add a new component, only two options appear (SLTS Image Componen and SLTS Visit Counter). If I back to old UI, add a view and then try to add a component, list is published as shown is youtube, but when I click on add, nothing happens. No items are added on drawable surface.
I was looking for errors in Tomcat log folder but nothing find. If I open Angular 2 UI with dev-tools, console show firtsly two erros:
Failed to load resource: the server responded with a status of 404 (Not found) ~https://fonts.googleapis.com/icon?family=Material+Icons
Failed to load resource: the server responded with a status of 404 (Not found) ~#angular/material/prebuilt-themes/deeppurple-amber.css
And before them, two more are shown continously:
ERROR TypeError: Cannot read property '_has' of undefined
at p (plotly.min.js:52)
at Object.t [as relayout] (plotly.min.js:52)
at WatchlistComponent.webpackJsonp.../../../../../src/app/appBody/watchlist/watchlist.component.ts.WatchlistComponent.autorangeChart (main.bundle.js:3859)
at main.bundle.js:3635
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (vendor.bundle.js:33289)
at Object.onInvokeTask (vendor.bundle.js:81064)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (vendor.bundle.js:33288)
at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (vendor.bundle.js:33056)
at webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask (vendor.bundle.js:33363)
at ZoneTask.invoke (vendor.bundle.js:33352)
defaultErrorLogger # vendor.bundle.js:78203
:8080/ScadaBR/api/point_value/getValue/null Failed to load resource: the server responded with a status of 400 (Bad request)
vendor.bundle.js:78203 ERROR Error: Uncaught (in promise): Response with status: 400 PeticiĆ³n incorrecta for URL: http://localhost:8080/ScadaBR/api/point_value/getValue/null
at resolvePromise (vendor.bundle.js:33648)
at resolvePromise (vendor.bundle.js:33619)
at vendor.bundle.js:33696
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (vendor.bundle.js:33289)
at Object.onInvokeTask (vendor.bundle.js:81064)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (vendor.bundle.js:33288)
at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (vendor.bundle.js:33056)
at drainMicroTaskQueue (vendor.bundle.js:33460)
at ZoneTask.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (vendor.bundle.js:33367)
at invokeTask (vendor.bundle.js:34235)
Could you help me please? Thanks in advance
Which version of Java, Tomcat and MySQL are you using?
The problem can be caused by too high version of Tomcat. We recommend to use version 7.0.82.
The simplest way to run Scada-LTS is to use our docker container:
https://github.com/SCADA-LTS/Scada-LTS/wiki/Run-ScadaLTS-on-docker---instruction

Resources