Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
8049 Lượt xem

Hello Odoo Community,

I modified contact us form by adding upload image and website field.

If i upload image in the back end everything is fine. But if i want to upload image on website (contact us form) and send the form all the custom field details goes through like website, but image don’t. Any suggestion why?

Any suggestion and help would be appreciated


Code example xml view image:

 <field name="image" widget="image" class="oe_left oe_avatar"/>  

Python:

image=fields.Binary('Image') 


Contact us form:

<div t-attf-class="form-group #{error and 'image' in error and 'has-error' or ''}">

<label class="col-md-3 col-sm-4 control-label" for="image">Image Upload</label>

<div class="col-md-7 col-sm-8">

<input type="file" class="form-control" name="image" t-attf-value="#{image or ''}"/>

</div>

</div>

Screenshots:

http://s24.postimg.org/oem4kg6z9/contactus.jpg

http://s28.postimg.org/7h9ico0vh/leadformview.jpg

Kind Regards,

Darius


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello Darius,

Your problems seems very simple, 

Did you included "enctype" attribute in your form ? Just like as below, ( See the enctype attribute only )

<form class="form-horizontal mt32" id="form_job_apply" action="/jobs/thankyou" method="post" enctype="multipart/form-data">

Tips : When you want to submit any binary data from web form, you must need to select "multipart/form-data" value for enctype attribute in your form. 

I am confident that your problem will be solved.



Ảnh đại diện
Huỷ bỏ
Tác giả

Is was already, but same issue.

Tác giả

I found where those images going :) ir.attachments, i will make something out of it now :), thanks for help anyway :)

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 11 17
4414
0
thg 6 25
2711
4
thg 1 23
18628
3
thg 3 24
17369
10
thg 4 21
22191