# CORRECTED CURL COMMAND FOR hero_images[] UPLOAD

## The Problem (From Your Log)

Your log shows:
"raw_files":["hero_image"]

This means Laravel ONLY received "hero_image", NOT "hero_images[]"
The hero_images[] files were never sent to the server!

## Issues with Your Original Command

1. ❌ hero_image uses postman-cloud:// URL (won't work in cURL)
2. ❌ hero_images[] files might have syntax errors
3. ❌ Extra leading slash: @"/C:/..." should be @"C:/..."

## CORRECTED COMMAND

### Option 1: Copy-Paste This (Windows PowerShell)

$image1 = "C:\Users\gamer\Downloads\shutterstock_141945937.webp"
$image2 = "C:\Users\gamer\Downloads\golden-retriever-dog-breed-info.jpeg"

# Verify files exist first
Test-Path $image1
Test-Path $image2

# If both return True, run this:
curl --location "http://localhost:8000/api/sections/footer" `
  --header "Accept: application/json" `
  --header "Authorization: Bearer hc7CtZwXYp1iyHuvaNlxU7LOiHnigzyv9uVPKkWfab102d49" `
  --form "Header=Testing123" `
  --form "hero_image=@$image1" `
  --form "hero_images[]=@$image1" `
  --form "hero_images[]=@$image2"

### Option 2: Bash-Style (Git Bash / WSL)

curl --location 'http://localhost:8000/api/sections/footer' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer hc7CtZwXYp1iyHuvaNlxU7LOiHnigzyv9uVPKkWfab102d49' \
  --form 'Header="Testing Array Upload"' \
  --form 'hero_image=@"C:/Users/gamer/Downloads/shutterstock_141945937.webp"' \
  --form 'hero_images[]=@"C:/Users/gamer/Downloads/shutterstock_141945937.webp"' \
  --form 'hero_images[]=@"C:/Users/gamer/Downloads/golden-retriever-dog-breed-info.jpeg"'

## What to Expect in Logs

BEFORE (Current - WRONG):
"raw_files":["hero_image"]
              ^^^^^^^^^^^^ Only one field!

AFTER (Correct):
"raw_files":["hero_image","hero_images"]
              ^^^^^^^^^^^  ^^^^^^^^^^^^^ Both fields!

## Expected Response

{
    "success": true,
    "message": "Section 'footer' updated successfully",
    "data": {
        "body": {
            "Header": "Testing Array Upload",
            "hero_image": "http://localhost:8000/storage/sections/xyz.webp",
            "hero_images": [                          ← Should be an ARRAY
                "http://localhost:8000/storage/sections/abc.webp",
                "http://localhost:8000/storage/sections/def.jpeg"
            ]
        }
    }
}

## Troubleshooting

If you still see only "raw_files":["hero_image"] in the logs:

1. Files might not exist - verify:
   Get-ChildItem "C:\Users\gamer\Downloads\*.webp"
   Get-ChildItem "C:\Users\gamer\Downloads\*.jpeg"

2. Find actual files:
   Get-ChildItem "C:\Users\gamer\Downloads\" -File | Where-Object { $_.Extension -match '\.(jpg|jpeg|png|webp)$' }

3. Use the automated script:
   .\test-corrected.ps1
   (This will automatically find available images)

## Common Mistakes to Avoid

❌ DON'T USE:
--form 'hero_images[0]=@"..."'  # Wrong: don't use numeric index
--form 'hero_images[1]=@"..."'  # Wrong: don't use numeric index
--form 'hero_image=@"postman-cloud://..."'  # Wrong: not a real file path

✅ DO USE:
--form 'hero_images[]=@"..."'   # Correct: empty brackets []
--form 'hero_images[]=@"..."'   # Correct: empty brackets []
--form 'hero_image=@"C:/path/to/real/file.webp"'  # Correct: real file path
