# 403 attaching a file

**URL:** <https://community.hubspot.com/t/403-attaching-a-file/86826>\
**Category:** APIs & Integrations\
**Tags:** php\
**Created:** [August 4, 2023, 11:53am UTC](https://community.hubspot.com/t/403-attaching-a-file/86826 "2023-08-04T11:53:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![psjavi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/psjavi/32/26462_2.png) [@psjavi](https://community.hubspot.com/u/psjavi)\
**Post date:** [August 4, 2023, 11:53am UTC](https://community.hubspot.com/t/403-attaching-a-file/86826/1 "2023-08-04T11:53:27Z")

</div>

Hi,

I’m trying to attach a file using the php api integration:

`"hubspot/api-client": "^10.1.0"`

I’ve the following code:

`$file = new \SplFileObject($fileObj->getRealPath());$fileName = $fileObj->getClientOriginalName();try { return $this->client->files()->filesApi()->upload($file, null, "/", $fileName, null, json_encode(["access" => "PRIVATE", "ttl" => "P2W", "overwrite" => false, "duplicateValidationStrategy" => "NONE", "duplicateValidationScope" => "EXACT_FOLDER"]) );} catch (ApiException $e) { Log::channel('hubspot')->error('Error al subir archivo:' . PHP_EOL . $e->getMessage(), ['response' => $e->getResponseBody()]); return false;}`

I’ve the integration permission in alowing the file’s handling but I’m getting the following error from Cloudflare Ray / [Hubapi.com](http://Hubapi.com):

 ![psjavi_0-1691155264320.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/b/1/b1abdae35c64e43dac44e8d4a0e781decf4fcd4a.png)

My app integration permissions:

 ![psjavi_1-1691156446339.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/8/8/88b5e7ec2e31055ab04255d9a82a13d53734af25.png)

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [August 4, 2023, 6:11pm UTC](https://community.hubspot.com/t/403-attaching-a-file/86826/2 "2023-08-04T18:11:46Z")

</div>

Hey, @psjavi 👋 That looks like you triggered a block from Clodflare.

One question. At the bottom of the error screen, is there a Cloudflare Ray ID? If so, can you DM me the Ray ID and the Portal ID (HubID number) you used when getting this error, please?

Thanks! — Jaycee

---

<div class="post-metadata">

**Author:** ![psjavi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/psjavi/32/26462_2.png) [@psjavi](https://community.hubspot.com/u/psjavi)\
**Post date:** [August 7, 2023, 10:30am UTC](https://community.hubspot.com/t/403-attaching-a-file/86826/3 "2023-08-07T10:30:00Z")

</div>

Hi [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074)  
Is this enough for you? This is all that I see in the response.

 ![hs_error.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/2X/d/da836089af918d4afeda9b686001754d361465fc.jpeg)

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [August 8, 2023, 10:22pm UTC](https://community.hubspot.com/t/403-attaching-a-file/86826/4 "2023-08-08T22:22:19Z")

</div>

Yes. I need you to copy and paste the Ray ID here. In this case, a screenshot won’t be enough.

Thanks! —Jaycee

---

<div class="post-metadata">

**Author:** ![psjavi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/psjavi/32/26462_2.png) [@psjavi](https://community.hubspot.com/u/psjavi)\
**Post date:** [August 9, 2023, 6:53am UTC](https://community.hubspot.com/t/403-attaching-a-file/86826/5 "2023-08-09T06:53:46Z")

</div>

Hi, the Ray ID is: 7f2ecdb41eb52fa1

---

<div class="post-metadata">

**Author:** ![psjavi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/psjavi/32/26462_2.png) [@psjavi](https://community.hubspot.com/u/psjavi)\
**Post date:** [August 10, 2023, 8:46am UTC](https://community.hubspot.com/t/403-attaching-a-file/86826/6 "2023-08-10T08:46:13Z")

</div>

Hello,

I think I have found the reason for the blockage, everything seems to point to the fact that your file storage provider is analysing the documents internally. I mean, the TXT file with which I am testing, has some internal notes with steps to follow to make some configurations in Amazon AWS.

It must be analysing the content and it must be finding some instruction as malicious. On the other hand, if I convert the file to PDF, for example, the file uploads correctly.

If I try a TXT with a normal paragraph, it attaches it without problems.

This is the content of the TXT file:

`Crear el rol para la instancia y asignárselo a la instanciaInstalar el cliente por shelldpkg --print-architecturecoger la version de la arquitectura correspondientewget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.debsudo dpkg -i -E ./amazon-cloudwatch-agent.debPasos adicionales recomendados:sudo mkdir /usr/share/collectdcd /usr/share/collectdsudo touch types.dbúltimo paso de subir la config decir NoInicia el Cloudwatch Agentsudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -sRevisa el estado del Serviciosudo systemctl status amazon-cloudwatch-agent-----AccederLogsEC2https://docs.aws.amazon.com/es_es/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-commandline-fleet.htmlhttps://grafana.com/docs/grafana/latest/datasources/aws-cloudwatch/`
