# Upload multiple file in one key

**URL:** <https://forum.robotframework.org/t/upload-multiple-file-in-one-key/8203>\
**Category:** Robot Framework\
**Created:** [22 December 2024 05:01 UTC](https://forum.robotframework.org/t/upload-multiple-file-in-one-key/8203 "2024-12-22T05:01:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mnaufaalh](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/mnaufaalh/32/4407_2.png) [@mnaufaalh](https://forum.robotframework.org/u/mnaufaalh)\
**Post date:** [22 December 2024 05:01 UTC](https://forum.robotframework.org/t/upload-multiple-file-in-one-key/8203/1 "2024-12-22T05:01:49Z")

</div>

Hello Guys, I have an issue

I want to implement from postman(form-data)

 ![Screenshot 2024-12-22 at 11.54.47](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/6/6ca189fe504300b6b967bc6f2dd3b62fe73de8e6.png)

I have the syntax  
${files}= Evaluate {‘item\_images’: (os.path.basename(“${filePath1}”), open(“${filePath1}”, ‘r+b’), “image/png”),‘item\_images’: (os.path.basename(“${filePath2}”), open(“${filePath2}”, ‘r+b’), “image/png”)}  
only filePath2 was created

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [22 December 2024 08:33 UTC](https://forum.robotframework.org/t/upload-multiple-file-in-one-key/8203/2 "2024-12-22T08:33:32Z")

</div>

Hi Muhammad,

It’s not clear what you are trying to do here? You mentioned postman(form-data), then showed a screenshot of what I guess is the app your trying to test, then give some robot code that looks like you might be trying to create a python dictionary?

It’s a good idea to indicate what library you are using.

If I’m guessing correctly you want to construct the http post body and post form data with requests library? (i’ll base my answer on this guess)

So first problem I see and it probably goes to explain why

> [@mnaufaalh](#):
>
> only filePath2 was created

In a dictionary, the key can only exist once:

> [@mnaufaalh](#):
>
> ${files}= Evaluate {‘item\_images’: (os.path.basename(“${filePath1}”), open(“${filePath1}”, ‘r+b’), “image/png”),‘item\_images’: (os.path.basename(“${filePath2}”), open(“${filePath2}”, ‘r+b’), “image/png”)}

Here you repeated `item_images`

So perhaps this will give you what you want?:

```python
${files}= Evaluate {‘item_images’: [(os.path.basename(“${filePath1}”), open(“${filePath1}”, ‘r+b’), “image/png”), (os.path.basename(“${filePath2}”), open(“${filePath2}”, ‘r+b’), “image/png”)]}

```

But that’s just a guess, normally people wouldn’t try to jam everything into 1 line with python code like this as it’s difficult for people who are not programmers to understand what’s happening.

The builtin keywords like [Create List](https://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Create%20List) and [Create Dictionary](https://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Create%20Dictionary) make it much clearer what you’re constructing, also [OperatingSystem Library](https://robotframework.org/robotframework/latest/libraries/OperatingSystem.html) has keywords for files and [Collections](https://robotframework.org/robotframework/latest/libraries/Collections.html) has keywords for manipulating lists and dictionaries if you need them.

Hopefully this helps,

Dave.
