I built up a form at the frontend to allow users to upload their avatars,my code looks like below

<form method="post" accept-charset="UTF-8" enctype="multipart/form-data">
    {{ csrfInput() }}
    <input type="hidden" name="action" value="users/save-user">
    <input type="hidden" name="redirect" value="users/{{ currentUser.username }}">
    <input type="hidden" name="userId" value="{{ currentUser.id }}">
    ...some other fields
    <input type="file" name="photo">

    <input type="submit" value="upload">

But I got error 'Serialization of 'Closure' is not allowed' from '/Users/rain/dev/valet/tr3ndsideas/vendor/yiisoft/yii2-queue/src/serializers/PhpSerializer.php' . Any idea please

  • You are using Craft 3 right? Because the photo is not an image but an asset. So you'll need to upload an asset first and connect it per id Mar 15 '18 at 21:57
  • @RobinSchambach How can I upload an asset? I already have some asset volumes. Sorry, I'm new to Craft xD
    – yu xia
    Mar 15 '18 at 23:11
  • Oh sorry I messed it up. You have to insert an image but it's treated like an asset afterwards. My bad, I didn't want to confuse you. I'll check this up later, as soon as I have enough time Mar 15 '18 at 23:24

I found the problem which is because of a package called "Scout". I just update it and everything seems to be fine now.

Not the answer you're looking for? Browse other questions tagged or ask your own question.