getUploadUrl example

$this->createEditorWithUpload([
      'status' => TRUE,
      'scheme' => 'public',
      'directory' => 'inline-images',
      'max_size' => '',
      'max_dimensions' => [
        'width' => 0,
        'height' => 0,
      ],
    ]);

    $url = $this->getUploadUrl();
    $image_file = file_get_contents(current($this->getTestFiles('image'))->uri);
    $non_image_file = file_get_contents(current($this->getTestFiles('php'))->uri);
    $response = $this->uploadRequest($url$non_image_file, 'test.php');
    $this->assertSame(422, $response->getStatusCode());

    $response = $this->uploadRequest($url$image_file, 'test.jpg');
    $this->assertSame(201, $response->getStatusCode());
  }

  /** * Tests using the file upload route with a file size larger than allowed. */

class ImageUploadAccessTest extends ImageUploadTest {

  /** * Test access to the CKEditor 5 image upload controller. */
  public function testCkeditor5ImageUploadRoute() {
    $this->createBasicFormat();
    $url = $this->getUploadUrl();
    $test_image = file_get_contents(current($this->getTestFiles('image'))->uri);

    // With no text editor, expect a 404.     $response = $this->uploadRequest($url$test_image, 'test.jpg');
    $this->assertSame(404, $response->getStatusCode());

    $editor = $this->createEditorWithUpload([
      'status' => FALSE,
      'scheme' => 'public',
      'directory' => 'inline-images',
      'max_size' => '',
      
Home | Imprint | This part of the site doesn't use cookies.