# createFile() permissions issue

**URL:** <https://forum.getkirby.com/t/createfile-permissions-issue/32550>\
**Category:** Questions\
**Created:** [September 24, 2024, 7:42am UTC](https://forum.getkirby.com/t/createfile-permissions-issue/32550 "2024-09-24T07:42:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jarneuyt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jarneuyt/32/9504_2.png) [@jarneuyt](https://forum.getkirby.com/u/jarneuyt)\
**Post date:** [September 24, 2024, 7:42am UTC](https://forum.getkirby.com/t/createfile-permissions-issue/32550/1 "2024-09-24T07:42:38Z")

</div>

Locally, the code works fine to create a file.  
When I upload the code to the hosting, I seem to be getting the error: “The file cannot be created”.

Can someone help?  
I tried changing the permissions of my folder on the hosting, but still the same issue.

```auto
$file = $page->createFile([
   'filename' => '666.pdf',
   'source' => $pdfName,
   'parent' => $page,
], true);

```

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/9/92e346e2751e7304c7d1cea43e1acdd5b4d17b60.png)

---

<div class="post-metadata">

**Author:** ![bastianallgeier](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bastianallgeier/32/7569_2.png) [@bastianallgeier](https://forum.getkirby.com/u/bastianallgeier)\
**Post date:** [September 24, 2024, 8:14am UTC](https://forum.getkirby.com/t/createfile-permissions-issue/32550/2 "2024-09-24T08:14:56Z")

</div>

The permission exception means, that there’s no authenticated user. Maybe you are logged into the panel locally and that’s why it works there.

---

<div class="post-metadata">

**Author:** ![jarneuyt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jarneuyt/32/9504_2.png) [@jarneuyt](https://forum.getkirby.com/u/jarneuyt)\
**Post date:** [September 25, 2024, 4:10pm UTC](https://forum.getkirby.com/t/createfile-permissions-issue/32550/3 "2024-09-25T16:10:10Z")

</div>

@bastianallgeier And how can I create a file without being logged in? Any visitor should be able to create a file…

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [September 25, 2024, 6:08pm UTC](https://forum.getkirby.com/t/createfile-permissions-issue/32550/4 "2024-09-25T18:08:44Z")

</div>

You might use [$kirby-\>impersonate() | Kirby CMS](https://getkirby.com/docs/reference/objects/cms/app/impersonate) in your code to add permissions that usually an authenticated user would have for scenarios where you don’t have any authenticated user.
