# \[embed form\] issue with upload field / version 4.0.1

**URL:** <https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235>\
**Category:** Product Support\
**Created:** [October 12, 2021, 10:11am UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235 "2021-10-12T10:11:33Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![raramuridesign](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/raramuridesign/32/13226_2.png) [@raramuridesign](https://forum.mautic.org/u/raramuridesign)\
**Post date:** [October 12, 2021, 10:11am UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/1 "2021-10-12T10:11:34Z")

</div>

**Your software**  
My Mautic version is: 4.0.1  
My PHP version is: 7.4.x  
My Database type and version is: mariadb

**Your problem**  
We have a form which is embedded on another webiste. (using the js method, we have tested with iframe and custom script, all have same result)  
CORS settings are all set correctly.

_When a user submits the form and chooses the form field to upload a file (pdf, set in field settings)_  
_The form does not submit and throws an error 500_

These errors are showing in the log:  
`[2021-10-12 09:54:30] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Attempted to call function "exif_imagetype" from namespace "Mautic\FormBundle\Helper"." at /home/xxx/public_html/app/bundles/FormBundle/Helper/FormUploader.php line 154 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Attempted to call function \"exif_imagetype\" from namespace \"Mautic\\FormBundle\\Helper\". at /home/xxx/public_html/app/bundles/FormBundle/Helper/FormUploader.php:154)"} []`

Steps I have tried to fix the problem:  
Not sure where to start.

---

<div class="post-metadata">

**Author:** ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)\
**Post date:** [October 12, 2021, 4:22pm UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/2 "2021-10-12T16:22:34Z")

</div>

Try to upload a picture and see if you get the same error

This is what the error references:

```
/**
 * Fix iOS picture orientation after upload PHP
 * https://stackoverflow.com/questions/22308921/fix-ios-picture-orientation-after-upload-php.
 *
 * @param $filename
 */
private function fixRotationJPG($filename)
{
    if (IMAGETYPE_JPEG != exif_imagetype($filename)) {
        return;
    }
    $exif = exif_read_data($filename);
    if (empty($exif['Orientation'])) {
        return;
    }
    $ort = $exif['Orientation']; /*STORES ORIENTATION FROM IMAGE */
    $ort1 = $ort;
    $exif = exif_read_data($filename, 0, true);
    if (!empty($ort1)) {
        $image = imagecreatefromjpeg($filename);
        $ort = $ort1;
        switch ($ort) {
            case 3:
                $image = imagerotate($image, 180, 0);
                break;

            case 6:
                $image = imagerotate($image, -90, 0);
                break;

            case 8:
                $image = imagerotate($image, 90, 0);
                break;
        }
    }
    imagejpeg($image, $filename, 90);
}

```

}

---

<div class="post-metadata">

**Author:** ![raramuridesign](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/raramuridesign/32/13226_2.png) [@raramuridesign](https://forum.mautic.org/u/raramuridesign)\
**Post date:** [October 13, 2021, 7:34am UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/3 "2021-10-13T07:34:32Z")

</div>

@EJL Thanks for the reply.  
We tested with an image (PNG) and this did not work.

Screenshot  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/3/3314e3bf8aac42b0cd82a8fb9223710864189cd8.png)

But our primary objective is to get a PDF uploaded, so not having this working is a concern.  
I am not sure why we would have a check for an image if we are uploading a PDF.

Thoughts?  
Matthew

---

<div class="post-metadata">

**Author:** ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)\
**Post date:** [October 13, 2021, 8:45pm UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/4 "2021-10-13T20:45:41Z")

</div>

That error indicates your browser is blocking based on cross-origins. Is your mautic installed on a subdomain or subdirectory of this particular site?

---

<div class="post-metadata">

**Author:** ![raramuridesign](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/raramuridesign/32/13226_2.png) [@raramuridesign](https://forum.mautic.org/u/raramuridesign)\
**Post date:** [October 18, 2021, 3:29pm UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/5 "2021-10-18T15:29:50Z")

</div>

@EJL This instance is on the same server and using a subdomain.  
WHM/CPANEL Server.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [October 19, 2021, 10:18am UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/6 "2021-10-19T10:18:14Z")

</div>

Hi,  
What else do you have on this server?  
Do you have Wordpress? If So do you have a WP plugin that maybe acts as firewall? Maybe Wordfence?  
Thx,  
Joey

---

<div class="post-metadata">

**Author:** ![raramuridesign](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/raramuridesign/32/13226_2.png) [@raramuridesign](https://forum.mautic.org/u/raramuridesign)\
**Post date:** [October 19, 2021, 6:53pm UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/7 "2021-10-19T18:53:15Z")

</div>

Hi @joeyk  
as a matter of interest, could you try to upload a PDF and see if you get the same issue or if this works.  
Image works on our side, but not the PDF…  
M

---

<div class="post-metadata">

**Author:** ![charlesn](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/charlesn/32/5378_2.png) [@charlesn](https://forum.mautic.org/u/charlesn)\
**Post date:** [November 3, 2021, 7:28pm UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/8 "2021-11-03T19:28:40Z")

</div>

@johan_jacobs this is the thread I mentioned in my email. @raramuridesign I tested adding the upload field on one of my forms and it works perfectly. I place my money on @joeyk’s comment above; so I have asked for the two WP sites to be removed from the web server.

---

<div class="post-metadata">

**Author:** ![raramuridesign](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/raramuridesign/32/13226_2.png) [@raramuridesign](https://forum.mautic.org/u/raramuridesign)\
**Post date:** [November 9, 2021, 3:49pm UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/9 "2021-11-09T15:49:28Z")

</div>

@EJL @joeyk  
I have created a test link with the form. If you fill out the details and try either a PDF or JPG you will see the form does not work.  
[https://code.devscreen.com/4sight/m.php](https://code.devscreen.com/4sight/m.php)

We get some issue with server error, see console. But this still does not make any sense as there is a cross origin issue. We have tested this on a different server which does not have cpanel but vanilla setup. So we are trying to isolate the issue here.

If you could take a look that would be awesome  
thanks  
M.

---

<div class="post-metadata">

**Author:** ![raramuridesign](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/raramuridesign/32/13226_2.png) [@raramuridesign](https://forum.mautic.org/u/raramuridesign)\
**Post date:** [November 9, 2021, 4:00pm UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/10 "2021-11-09T16:00:35Z")

</div>

@joeyk @EJL Here is the error from the last test on that link

```auto
[2021-11-09 15:47:52] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Attempted to call function "exif_imagetype" from namespace "Mautic\FormBundle\Helper"." at /home/xxxx/public_html/app/bundles/FormBundle/Helper/FormUploader.php line 154 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Attempted to call function \"exif_imagetype\" from namespace \"Mautic\\FormBundle\\Helper\". at /home/xxxx/public_html/app/bundles/FormBundle/Helper/FormUploader.php:154)"} []

```

---

<div class="post-metadata">

**Author:** ![raramuridesign](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/raramuridesign/32/13226_2.png) [@raramuridesign](https://forum.mautic.org/u/raramuridesign)\
**Post date:** [January 2, 2022, 4:14pm UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/11 "2022-01-02T16:14:54Z")

</div>

@joeyk @EJL Just wondering if you had a chance to relook at this error as per my note from Nov 21?

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [January 3, 2022, 10:06am UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/12 "2022-01-03T10:06:29Z")

</div>

I tested the form, and I still see the cross origin issue with another URL ending with .cloud  
You have to look into that for sure.

---

<div class="post-metadata">

**Author:** ![charlesn](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/charlesn/32/5378_2.png) [@charlesn](https://forum.mautic.org/u/charlesn)\
**Post date:** [January 17, 2022, 10:25am UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/13 "2022-01-17T10:25:21Z")

</div>

Hello @raramuridesign, see the comment above, have you managed to look into this for us yet? We need to get this upload field working soonest, thanks!

---

<div class="post-metadata">

**Author:** ![raramuridesign](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/raramuridesign/32/13226_2.png) [@raramuridesign](https://forum.mautic.org/u/raramuridesign)\
**Post date:** [January 31, 2022, 1:26pm UTC](https://forum.mautic.org/t/embed-form-issue-with-upload-field-version-4-0-1/21235/14 "2022-01-31T13:26:49Z")

</div>

Here is an update after many hours of checking into why this happend!  
Firstly, this had nothing to do with CORS. Although a different issue entirely.

Secondly, the server is running WHM/CPANEL environment.  
Managed by the Hosting company, the default - chosen install by the host is to omit the very important module called - exif.

exif is required to understand the file types when uploaded by mautic.

Once this was installed and activated - the remote form embed worked without any issues.

There is an open issue on github to address the minimum requirements for Mautic, as a pre-install check. I hope this is also included soon, so these type of issues are addressed at installation, rather than when the mautic app is in full production mode.

reference: [Mautic allows you to install with missing PHP modules · Issue #10805 · mautic/mautic · GitHub](https://github.com/mautic/mautic/issues/10805)
