From 66b6fd0f0437ab1d907d89fa0caf115b3a4787b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Fri, 26 Jan 2018 11:44:11 +0100 Subject: [PATCH] [BrowserKit] Add snippet: how to upload a file --- components/browser_kit.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/browser_kit.rst b/components/browser_kit.rst index a55134293a0..7bafa322643 100644 --- a/components/browser_kit.rst +++ b/components/browser_kit.rst @@ -109,6 +109,9 @@ method (which makes the needed HTTP POST request to submit the form contents):: $form['login'] = 'symfonyfan'; $form['password'] = 'anypass'; + // To upload a file, the value should be the absolute file path + $form['file'] = __FILE__; + // submit that form $crawler = $client->submit($form);