diff --git a/yesod-test/Yesod/Test.hs b/yesod-test/Yesod/Test.hs
index 74874f6a..2762f42d 100644
--- a/yesod-test/Yesod/Test.hs
+++ b/yesod-test/Yesod/Test.hs
@@ -75,6 +75,7 @@ module Yesod.Test
, byLabel
, byLabelExact
, fileByLabel
+ , fileByLabelExact
-- *** CSRF Tokens
-- | In order to prevent CSRF exploits, yesod-form adds a hidden input
@@ -678,6 +679,8 @@ byLabelExact = byLabelWithMatch (==)
-- >
+--
+-- Warning: There exists the same issue of 'byLabel'. Please use 'fileByLabelExact' instead.
fileByLabel :: T.Text -- ^ The text contained in the @\@.
-> FilePath -- ^ The path to the file.
-> T.Text -- ^ The MIME type of the file, e.g. "image/png".
@@ -686,6 +689,38 @@ fileByLabel label path mime = do
name <- genericNameFromLabel T.isInfixOf label
addFile name path mime
+ -- | Finds the @\@ with the given value, finds its corresponding @\ @, then adds a file for that input to the request body.
+--
+-- ==== __Examples__
+--
+-- Given this HTML, we want to submit a file with the parameter name @f1@ to the server:
+--
+-- >
+--
+-- You can set this parameter like so:
+--
+-- > request $ do
+-- > fileByLabel "Please submit an image" "static/img/picture.png" "img/png"
+--
+-- This function also supports the implicit label syntax, in which
+-- the @\ @ is nested inside the @\@ rather than specified with @for@:
+--
+-- >
+--
+-- @since 1.5.9
+fileByLabelExact :: T.Text -- ^ The text contained in the @\@.
+ -> FilePath -- ^ The path to the file.
+ -> T.Text -- ^ The MIME type of the file, e.g. "image/png".
+ -> RequestBuilder site ()
+fileByLabelExact label path mime = do
+ name <- genericNameFromLabel (==) label
+ addFile name path mime
+
-- | Lookups the hidden input named "_token" and adds its value to the params.
-- Receives a CSS selector that should resolve to the form element containing the token.
--