> For the complete documentation index, see [llms.txt](https://testingvn.gitbook.io/playwright/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://testingvn.gitbook.io/playwright/implement-test-cases/upload-file.md).

# Upload file

```typescript
import {test, expect} from '@playwright/test';

test('upload a file', async ({page}) => {
    await page.goto('/upload');
    
    const filePath = 'download/bb.txt';
    await page.setInputFiles('input[type="file"]', filePath);
    
    await page.getByRole('button', { name: 'Upload' }).click();
    await expect(page.locator('#uploaded-files')).toContainText('bb.txt');
});

```
