# File upload using postman without FILE option

**URL:** <https://community.postman.com/t/file-upload-using-postman-without-file-option/1438>\
**Category:** Help Hub\
**Created:** [April 16, 2018, 1:37pm UTC](https://community.postman.com/t/file-upload-using-postman-without-file-option/1438 "2018-04-16T13:37:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Avdhesh752](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@Avdhesh752](https://community.postman.com/u/Avdhesh752)\
**Post date:** [April 16, 2018, 1:37pm UTC](https://community.postman.com/t/file-upload-using-postman-without-file-option/1438/1 "2018-04-16T13:37:59Z")

</div>

Could you please tell me how to upload file without USING File option. I would like to know how I can upload file by following below approach.

From Body - Form data - Type as Text approach  
How I can upload file using Body - raw - Json file type  
I do not want to use File \> Choose File option. I would like to execute through newman and using File \> Choose file option it is failing.

I tried to use below approach but it is giving 404 as response.  
Body - Raw–\>  
{  
“uploadType”: “ORDER”,  
“headerIncluded”:“false”,  
“file”:“C:/Users/b3badm/Desktop/SIndoora/FileImport\_ValidProducts.txt”  
}

---

<div class="post-metadata">

**Author:** ![claire](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/claire/32/99_2.png) [@claire](https://community.postman.com/u/claire)\
**Post date:** [April 16, 2018, 10:20pm UTC](https://community.postman.com/t/file-upload-using-postman-without-file-option/1438/2 "2018-04-16T22:20:30Z")

</div>

Hi @Avdhesh752! You’ll want to check out [this blog post](http://blog.getpostman.com/2017/09/21/run-collections-with-file-uploads-using-newman/) 🌟

---

<div class="post-metadata">

**Author:** ![jakub.danek](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jakub.danek](https://community.postman.com/u/jakub.danek)\
**Post date:** [October 10, 2018, 9:24am UTC](https://community.postman.com/t/file-upload-using-postman-without-file-option/1438/3 "2018-10-10T09:24:50Z")

</div>

Hi @claire, is there any way to set the src value from Postman before exporting a collection? Because having to manually edit the collection after each export is a bit annoying.

---

<div class="post-metadata">

**Author:** ![claire](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/claire/32/99_2.png) [@claire](https://community.postman.com/u/claire)\
**Post date:** [October 11, 2018, 12:31am UTC](https://community.postman.com/t/file-upload-using-postman-without-file-option/1438/4 "2018-10-11T00:31:14Z")

</div>

Hi @jakub.danek! At the moment I don’t believe there is a way to do that, however that makes sense as something we can look into improving - if you have a free moment, we’d love for you to post this in #feature-requests!

---

<div class="post-metadata">

**Author:** ![Madhu.Gonthina](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/madhu.gonthina/32/13175_2.png) [@Madhu.Gonthina](https://community.postman.com/u/Madhu.Gonthina)\
**Post date:** [September 9, 2022, 5:44am UTC](https://community.postman.com/t/file-upload-using-postman-without-file-option/1438/5 "2022-09-09T05:44:19Z")

</div>

1. Place the files you want to upload in a location.

2. Create a csv data file ( file.csv ) and place the file names you want to upload as shown below

![Files](https://us1.discourse-cdn.com/getpostman/original/2X/3/3635fff93b14adae5b6c628e58bc921fada82187.jpeg)

1. In your Pre-request script, add set a variable as shown below

pm.environment.set(“filepath”,data.\_filepath);

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/a/aa248021a930634bd09f27ff53073edb21f72c1b.png)

1. Open your collection.json file and you will find the below formdata where you have selected the file location as shown below

“method”: “POST”,  
“header”: ,  
“body”: {  
“mode”: “formdata”,  
“formdata”: [  
{  
“key”: “File”,  
“type”: “file”,  
**“src”: “/C:/here/prod.json”**  
}

here, modify **“src”: “/C:/here/prod.json”** to **“src”: “{{filepath}}”**

1. Now navigate to the path where you have the files and want to upload. So, in my case I navigated to **C:\here** and launched cmd from here and executed below command.

newman run --insecure \<collection\_path\>\Products.postman\_collection.json -d \file.csv -r htmlextra --reporter-htmlextra-export “\<Report\_path\>\Fileupload.html” --reporter-htmlextra-title “\<Report\_Name\>”

Now my test will run with two iteration as shown below

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/d/db0b15cb21776f1dd51fa626f23f91d0d9869dc5.png)

Iteration1 - you will find the Request body as

{  
“File”: “prod.json”  
}

Iteration2 - you will find the Request body as

{  
“File”: “str.json”  
}

Hope, this solution helps us in not selecting a static file and upload all the desired files from selected location
