> For the complete documentation index, see [llms.txt](https://mostafaznv.gitbook.io/larupload/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mostafaznv.gitbook.io/larupload/advanced-usage/attachment/store-original-file-name.md).

# Store Original File Name

<mark style="color:red;">\[Deprecated]</mark> The `storeOriginalFileName` function on the `Attachment` is used to enable or disable the storage of the original name of uploaded files in the database.

Since files may be stored with custom file names based on your preferred <mark style="color:red;">naming method</mark>, storing the original file name in the database can be beneficial for displaying it in your application's UI or elsewhere.

```php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Mostafaznv\Larupload\Storage\Attachment;
use Mostafaznv\Larupload\Traits\Larupload;

class Media extends Model
{
    use Larupload;

    public function attachments(): array
    {
        return [
            Attachment::make('file')->storeOriginalFileName(true)
        ];
    }
}
```

{% hint style="info" %}
This feature has been available since version <mark style="color:red;">2.2.0</mark>
{% endhint %}

{% hint style="warning" %}
This feature has been <mark style="color:red;">deprecated</mark> since version <mark style="color:red;">3.0.0</mark> and storing original file names is now enabled by default.
{% endhint %}

{% hint style="warning" %}
By enabling this property, all your uploading processes will store the original file name in the database. Therefore, you need to add a<mark style="color:red;">`{$name}_file_original_name`</mark> column to all relevant tables.

For new tables, this will be handled by default. However, if you want to use this feature with existing tables, you must create a [new migration](/larupload/advanced-usage/migrations/add-original-file-name-to-existing-tables.md) file and add the column to those tables.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mostafaznv.gitbook.io/larupload/advanced-usage/attachment/store-original-file-name.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
