Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: allow setting through a variable the name of the file to upload #3641

Open
josslamberti opened this issue Oct 16, 2017 · 10 comments

Comments

@josslamberti
Copy link

josslamberti commented Oct 16, 2017

App Details:

Postman for Windows
Version 5.3.0
win32 10.0.15063 / x64

Feature Request:

When a request includes a file to upload, I'd like to be able to set the name of the file through a variable and/or in the pre-request script.
Currently, when I set the body to 'form-data' and add a key with the type 'file', the only way to set the file to upload is through the file picker. It would be useful to use an environment variable to set the filename (for example, the API I'm testing requires a new file name for every request to avoid erroneous duplicates).

@sdnts
Copy link

sdnts commented Oct 18, 2017

@josslamberti Thanks for the suggestion! We'll take a look at this.

@karthiksml
Copy link

may i know the status of this issue? we are in a situation to use this :)

@vkaegis
Copy link
Member

vkaegis commented Mar 23, 2019

No ETA just yet. We have some work on variable types on our roadmap, so we'll consider this request then.

@DustinHendrickson
Copy link

Would love to see this feature, would save me like an hour of manually dredging through tons of file setting options.

@barcooverture
Copy link

We would love that too !

Also when importing a collection (because we use newman), the path we could set manually in json is removed...

@levyblue
Copy link

levyblue commented Jan 1, 2020

It would be great o see this added. Its been 2 years since the suggestion. Hopefully, it will be added at some point....

@schmitzdenis
Copy link

schmitzdenis commented Feb 11, 2020

It is actually possible. just export the collection to .json and replace the file path by a placeholder like this.

"formdata": [{
		 "key": "filename",
		 "contentType": "image/jpeg",
		 "type": "file",
		 "src": "{{filePath}}"
		}],

Re import the collection.json back in postman.make sure your files to upload are in your local postman working_directory.

@Chekkov
Copy link

Chekkov commented Feb 12, 2020

Hi, @schmitzdenis : Thanks, for the hint. This works only once.
But, we wanted to exchange the src-file during runtime, e.g. for iteration.

@schmitzdenis
Copy link

Not sure to understand the issue then @Chekkov , the filePath will change with any value it's assigned to. So for every iteration of a postman runner, or when you change it with pre-request script at runtime as an example ..

@Oliver-Java
Copy link

It is actually possible. just export the collection to .json and replace the file path by a placeholder like this.

"formdata": [{
		 "key": "filename",
		 "contentType": "image/jpeg",
		 "type": "file",
		 "src": "{{filePath}}"
		}],

Re import the collection.json back in postman.make sure your files to upload are in your local postman working_directory.

I have tried but get the same error each time
" Form param document, file load error: "pdf", no such file "

code:
"key": "document",
"type": "file",
"src": "{{pdf}}"

Inside postman the
VALUE field has {{pdf}} in white, written inside the usualy file-name box deletable with x.

Any solution appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests