Playing Next Lesson In
seconds

Let's Learn AdonisJS 6 #11.6

Uploading Movie Cover Images in our Create or Edit Form

In This Lesson

We'll learn how to upload movie cover images when either creating or editing a movie via our create or edit form.

Created by
@tomgobich
Published

🕰️ Chapters
00:00 - Lesson Objective
00:40 - Reusing Our Avatar Upload Fields
02:40 - Reviewing Avatar Upload Logic
03:22 - Adding Poster Field Validations
04:08 - Movie Creation Cover Upload
06:48 - Movie Edit Cover Upload & Deletion
07:58 - Testing Our Cover Upload
09:15 - Moving Cover Image Upload to a Service

Join the Discussion 3 comments

Create a free account to join in on the discussion
  1. @codthing

    When testing in Postman, I encounter a "slug uniqueness error" on the third consecutive form submission without changing the input. The error occurs in the store method, which validates the request, processes the poster file, and creates a movie record. The database throws a duplicate key error because the slug already exists, violating the movies_slug_unique constraint. This likely happens because the slugify method, provided in the course, fails to generate a unique slug for repeated sub

    1
    1. Responding to codthing
      @codthing

      The issue lies in the fact that only English letters are supported, so we should first ensure that the title is in English, and then verify its uniqueness. It is recommended to use the transliteration library.

      1
      1. Responding to codthing
        @tomgobich

        Ah, I'm happy to hear you were able to track down the root cause! Sorry there wasn't a warning in-video about that, codthing! Locales on the slugify didn't even occur to me.

        1