Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
How to upload editor js images using symfony framework?

How to upload editor js images using symfony framework?

Here is my upload function in Controller. Codes in the function works as I have tried to upload by using traditional forms. <form></form>

/**
 * @Route("/uploadImage", name="upload")
 */
public function upload(Request $request): Response
{
    $file = $request->files->get['image'];
    $uploads_dir = $this->getParameter('uploads_dir');
    $filename = md5(uniqid()) . ' . ' . $file->guessExtension();
    $file->move(
        $uploads_dir,
        $filename
    );
    $fileurl = $uploads_dir + $filename;

    $response = JsonResponse::fromJsonString('{"success":1, "file": {"url":"$fileurl"}}');
    return $response;
}

services.yaml (set up for storing images)

parameters:
    uploads_dir: '%kernel.project_dir%/public/uploads'

And this is my code in Javascript for Editorjs:

const editor = new EditorJS({

   holder: 'editor',
   
        tools: {
         header: Header,        
         list: List,        
         checklist: Checklist,
         quote: Quote,
         code: CodeTool,
         table: Table,

        image: {
            class: ImageTool, 
            config: {
                endpoints: {
                    byFile: '/uploadImage', // Your backend file uploader endpoint
                    byUrl: '/uploadImage', // Your endpoint that provides uploading by Url
                }
            }
        }
     }

});

I have tried to pass image data to the controller to process uploading, but it fails.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!