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

CC BY-SA 3.0
2018-03-16T03:23:14.307Z
2018-03-16T03:23:14.307Z
yu xia
<p>I built up a form at the frontend to allow users to upload their avatars,my code looks like below</p>

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

    &lt;input type="submit" value="upload"&gt;
&lt;/form&gt;
</code></pre>

<p>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 </p>

CC BY-SA 3.0
2018-03-15T21:57:59.450Z
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
Robin Schambach
CC BY-SA 3.0
2018-03-15T23:11:25.587Z
@RobinSchambach How can I upload an asset? I already have some asset volumes. Sorry, I'm new to Craft xD
yu xia
CC BY-SA 3.0
2018-03-15T23:24:57.137Z
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
Robin Schambach
<image><upload>
Serialization of 'Closure' is not allowed when upload image
# Serialization of 'Closure' is not allowed when upload image

(Asked by: username_0 on 2018-03-15)

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

    {{ csrfInput() }}
    
    
    
    ...some other fields
    

    


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

**Tags:** image, upload
> **Comments:**
> **username_1**: 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  
> **username_0**: @RobinSchambach How can I upload an asset? I already have some asset volumes. Sorry, I'm new to Craft xD  
> **username_1**: 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  

---

## 1 answers

### Answer by username_0 on 2018-03-16. Score: 0

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


---

