Тёмный

POST form-data file upload + JSON 

Valentin Despa
Подписаться 60 тыс.
Просмотров 168 тыс.
50% 1

Postman allows you to submit a form-data request where in one key you send a file and in the other key you send JSON.
___
// POSTMAN COMPLETE GUIDE ONLINE COURSE
👉 Want to learn more about Postman? Check my Postman online course.
Get it at a special price and help support this RU-vid channel:
vdespa.com/cou...
___
// I HAVE A QUESTION!
I do my best to answer all comments here on RU-vid but I cannot make any guarantees.
If you have a question, it is best to ask your question on the Postman User Group on Discord ( / discord .
If you have purchased the Postman Online Course, please use the Q&A section or send me a message on Udemy.
Please do not email me or contact me on other channels as I might not be able to answer. Sorry!
___
// I HAVE A VIDEO IDEA
Do you want me to create a video on a specific topic? Just fill out the form below:
forms.gle/uWEz...
___
// P L A Y L I S T S
▸ Learn Postman | bit.ly/2CFaf70
▸ Postman Crash Course | bit.ly/2YwEBBT
▸ Postman Tips & Tricks | bit.ly/2JLkXyU
___
// F R E E R E S O U R C E S
▸▸▸ DOWNLOAD the FREE Postman Quick Reference Guide
bit.ly/postman-...
▸▸▸ Ask a question on Discord
/ discord
▸▸▸ JOIN the Postman User Group on Facebook
bit.ly/2OutAMZ
▸▸▸ The OFFICIAL Postman community forum
community.getp...
▸▸▸ 👉 Subscribe to the "Testing and automation with Valentine" newsletter for bi-weekly tutorials, tips, and news from the industry.
eepurl.com/gPwpU1
___
// IMPRINT
vdespa.com/imprint
---

Опубликовано:

 

4 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 157   
@veziop
@veziop 2 года назад
postman really needs a new UX team...
@udarajayawardena2018
@udarajayawardena2018 3 года назад
how do you get the data value in backend
@mariawaheed7173
@mariawaheed7173 4 месяца назад
Thank you for your guidance it helps me alot in my Fax sending API 😊
@vdespa
@vdespa 4 месяца назад
Fax sending? I didn't know you are working with cutting edge technologies ;) Glad it helped!
@krulikonik
@krulikonik Месяц назад
Человек, ты реально меня спас!
@ngoalalibo4862
@ngoalalibo4862 3 года назад
Thanks for the video. However I would have liked to see parameters from the controller itself.
@vdespa
@vdespa 3 года назад
Thanks for your feedback.
@gpet2184
@gpet2184 Год назад
I think it is resulting text not json format to be requested
@helsinkired8523
@helsinkired8523 Год назад
yeah, even when i select application/json in content type it's sending the data as a text.
@safiullalam5544
@safiullalam5544 6 месяцев назад
@@helsinkired8523 Did you find any solution without using the json_decode in the backend?
@ferdinandjukorandrianirimi5185
You gonna have a new subscriber today bro🤞
@vdespa
@vdespa Год назад
Thanks 🙏
@imgullu
@imgullu Год назад
Thank you for the video it was very helpful
@vdespa
@vdespa Год назад
Glad it was helpful! You are welcome. Thank you for leaving a comment.
@itsaminj9891
@itsaminj9891 Год назад
You just saved me my job. Thanks.
@vdespa
@vdespa Год назад
Glad I could help! You are welcome. Thank you for leaving a comment.
@helsinkired8523
@helsinkired8523 Год назад
when i select application/json in content type for data, it's not sending the data in json format, it is sending as a string. can you please help me with this.
@safiullalam5544
@safiullalam5544 6 месяцев назад
Did you found any solution for this?
@yarriswamykajji4657
@yarriswamykajji4657 2 года назад
how can we send list of json and files through single request
@drorcohen7847
@drorcohen7847 2 года назад
what if the file that i want to upload is part of my json request? { "fileName": "test", "fileType": ".txt", "path": "dev-test", "content": {this is where i expect the file to be} } how do i pass this content parameter as a file in postman?
@vdespa
@vdespa 2 года назад
Postman can't read files. So you need to expose them through an API.
@RahulKrishan-w3g
@RahulKrishan-w3g 9 месяцев назад
bro you save the day😁
@vdespa
@vdespa 9 месяцев назад
Glad that it helped! Thank you for leaving a comment.
@vdespa
@vdespa 3 года назад
Download the FREE Postman Quick Reference Guide 👉 www.subscribepage.com/postman
@moviesandcartoons479
@moviesandcartoons479 8 месяцев назад
I'm using postman to test my app. From there using form-data I will enter key one name and mention type is file. Values I will upload a file. How to get that key and value in the django app to perform operations on that file and resend the JSON response of that operation output.
@vivekm07
@vivekm07 2 года назад
this was helpful. keep posting videos like this. thanks
@vdespa
@vdespa 2 года назад
Thanks, will do! You are welcome. Thank you for leaving a comment.
@FernandoSilva-yv4bc
@FernandoSilva-yv4bc 9 месяцев назад
you save my life , thank you so much
@vdespa
@vdespa 9 месяцев назад
Glad to hear that! You are welcome. Thank you for leaving a comment.
@قناةأحداثوروايات
Hi tanks for your videos, when upload file Take this note: This file isn't in your working directory. Teammates you share this request with won't be able to use this file, yo make collaboration easier you can setup your working directory in settings, whats the problem and give me solution plz. I use Selected location postman/file and on allow reading files outside working directory , but don't working.
@MrutyunjaySambalad
@MrutyunjaySambalad 7 месяцев назад
can we add JSON data in "raw" instead of selecting data in data-form
@murilolivorato1489
@murilolivorato1489 9 месяцев назад
to me it is sending json as text
@phamtienthinh1795
@phamtienthinh1795 7 месяцев назад
Bro, you don't show the script, How could we understand what's going on ?
@gupthaa2294
@gupthaa2294 Год назад
Can you please show the file upload example video with query params, path params, body param , in one POST API request, thanks
@yevheniishyshkin3032
@yevheniishyshkin3032 7 месяцев назад
Thank you!
@vdespa
@vdespa 7 месяцев назад
You are welcome. Thank you for leaving a comment.
@mariawaheed7173
@mariawaheed7173 4 месяца назад
I have successfully attached my file in postman request by following your tutorial and request was successful and fax sent. But attachment was not received by receiver. It was empty fax. Can u help me out on that?
@vdespa
@vdespa 4 месяца назад
I can try. Send me over some details on X @vdespa
@aashishupadhyay5566
@aashishupadhyay5566 2 года назад
content type column is hidden in my case how to get it?
@vdespa
@vdespa 2 года назад
I have went over that aspect in the video. See around 2:10
@govinda399
@govinda399 Год назад
saved my time bro
@vdespa
@vdespa Год назад
Glad it helped!
@sherinpm604
@sherinpm604 2 года назад
Thanks for the much details explanation. It was easy to understand.
@vdespa
@vdespa 2 года назад
I am glad that it was helpful.
@anusharacer
@anusharacer Год назад
I have huge json request. If i paste it in postman it becomes stuck. How can I paste it in a text file and pass as form-data in postman?
@brendon205
@brendon205 2 года назад
my postman is still not accepting a filed that is an array with objects :/
@khaledxyz
@khaledxyz 2 года назад
Thanks, very helpfull 🙏
@vdespa
@vdespa 2 года назад
Glad it was helpful! You are welcome. Thank you for leaving a comment.
@umarkhankhodjaev
@umarkhankhodjaev 9 месяцев назад
You put bread on my table , Thanks
@vdespa
@vdespa 9 месяцев назад
Glad to hear that. You are welcome. Thank you for leaving a comment.
@TechiesUnofficial
@TechiesUnofficial Год назад
Why does your result show as JSON but mine simply shows the HTML from the PHP file I'm sending my post request to?
@vedanthikarthik5926
@vedanthikarthik5926 Год назад
I have application deployed in websphere, I need to pass a json where values are in Scandinavian characters. But I'm getting a garbage value when I receive. Let me know when can be done
@govinda399
@govinda399 Год назад
i want to send address along with name and a file, but when i see in MongoDB database it is a string. yes is did change that content type as application/json still what i am getting in MongoDB is string of the object
@anishmathew7108
@anishmathew7108 8 месяцев назад
Can you explain the spring boot controller class corresponding to this api
@gourav6859
@gourav6859 Год назад
Is necessary our first filed is file type in form-data. If my input fields only form type means no any file type option so what my request is not sent because when I write console.log (req.body) so in console gives output blank curly braces {}. When I send the request using body raw so data sent successfully. How i solve this issue.
@gmmkeshav
@gmmkeshav 2 года назад
please also show the code side what are you doing at backend
@ngocmanprocoder
@ngocmanprocoder 11 месяцев назад
I encountered the error "This file isn't in your working directory. Teammates you share this request with won't be able to use this file. To make collaboration easier you can setup your working directory in Settings" after uploading the files. Could you help me fix it, please? Thank you so much.
@vdespa
@vdespa 11 месяцев назад
Local files are not shared. This is what the warning is telling you.
@Omesh7
@Omesh7 4 месяца назад
This is great, but I just can't replicate the same with javascript or anything
@vitorialucena7722
@vitorialucena7722 Год назад
Whats the difference in using form-data and binary?
@vdespa
@vdespa Год назад
Hey Vitória, please read this article: medium.com/p/1cd2307ed6aa
@tusharborkar93
@tusharborkar93 Год назад
How to read file and json data in java code using spring boot?
@infotainmentchannel1800
@infotainmentchannel1800 Год назад
How to pass arrays in get request inside headers ?
@nailabouadil8357
@nailabouadil8357 9 месяцев назад
Thank you
@vdespa
@vdespa 9 месяцев назад
You are welcome. Thank you for leaving a comment.
@BUSYDEV
@BUSYDEV 6 месяцев назад
Make a similar video but with Thunderclient
@vdespa
@vdespa 6 месяцев назад
Sure. Thank you for the suggestion :)
@TestAccount-rf1qy
@TestAccount-rf1qy Год назад
Thanks for explanation. I need to know how can I send binary file in form-data? My API excepting data as form-data and inside that one field is for file but in binary
@vdespa
@vdespa Год назад
Select the file type and select the binary file.
@TestAccount-rf1qy
@TestAccount-rf1qy Год назад
​@@vdespa Thanks its worked with image file as well. postman is sending in binary only . However thanks for reply really appreciate.
@fnln1654
@fnln1654 7 месяцев назад
Thankyou so much!
@vdespa
@vdespa 7 месяцев назад
You are welcome. Thank you for leaving a comment.
@SehrishMoujahid
@SehrishMoujahid Год назад
I am facing issue while uploading image
@shrunotik
@shrunotik 3 года назад
Thanks!
@vdespa
@vdespa 3 года назад
You're welcome
@kavithaksk
@kavithaksk 2 года назад
I want to send a encoded Json string to the api as the controller accepts in the [FromForm] string encodedJson format. I tried the above approach by setting the content-type as application/json;charset=utf-8. But the controller is receiving NULL at its end. May I know what could be wrong with this ?
@hamidRaven13
@hamidRaven13 8 месяцев назад
uuuh uuh very helpful thank you👍
@vdespa
@vdespa 8 месяцев назад
Happy to help! You are welcome. Thank you for leaving a comment.
@srinivasvaranasi6474
@srinivasvaranasi6474 2 года назад
I want to post the file as blob and json as clob into a database when I run the rest api, do you have any samples.
@noordinabdulkadir1647
@noordinabdulkadir1647 2 года назад
my request.body object is empty when sending form data for patch requests -- And i know this is related to bodyparser and express middlewares but it the problem remains even though i have app.use(express.urlencoded({extended:true})) and app.use(express.json()).
@codecrafts5263
@codecrafts5263 Год назад
Did you find the solution?
@nicolascheneaux2612
@nicolascheneaux2612 2 месяца назад
Thank u
@vdespa
@vdespa 2 месяца назад
You are welcome. Thank you for leaving a comment.
@chundurusriharsha2402
@chundurusriharsha2402 3 года назад
Hi, When I download the JSON file and upload it to another site it shows the JSON version is 1.0 we only support 2.0 to upload it. So Is there any way to change or upgrade it or can you tell me how to upload it without an error?
@rohitnegi663
@rohitnegi663 Год назад
are you sure data key is sent as json file ? because i can see string " " like this outside "{'name': 'noname'}" something like this.
@liyuliu3587
@liyuliu3587 Год назад
how do you resolve this problem?
@balajicmb1132
@balajicmb1132 2 года назад
I need your help. How to upload excel file is finish my code. But how to update record excel sheet sir.
@vdespa
@vdespa 2 года назад
Please watch this tutorial: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-EGluwE-P4u4.html
@dearshoberoi285
@dearshoberoi285 3 года назад
Json data always gets converted to a string rather than an object in the text part. How should I solve this issue?
@mukeshwars5570
@mukeshwars5570 2 года назад
using gson
@xerasy20
@xerasy20 2 года назад
So How can i post raw json request with a byte[]? Postman Side: { "packageId": "{{$guid}}", "packageData" : [some, data, which, i, read, from, my, local, working, computer, directory, and, automatically, converted, to, byte, array], } -------------------------- .Net Core Web Api Side: (c# Backend) [HttpPost] public Task UploadPackage(UploadPackageRequest request) { return _appService.UploadPackage(request); }
@vdespa
@vdespa 2 года назад
Postman can't read any any local files. If you need this, you need to expose those files though an API.
@sreeRocksRocks
@sreeRocksRocks 2 года назад
I want to upload a zip file along with other text fields part of the POST call. My sample fields looks like this. field1: "loadData": "true" and field2 : {mime:"application/octet-stream", filename:"File123.zip"}. How to make a call using Postman with these fields ? Please let me know if you are looking for more details
@vdespa
@vdespa 2 года назад
How is your use-case different from the example shown in the tutorial? The idea is the same. Or am I missing something?
@bitbeee
@bitbeee 4 месяца назад
useful
@vdespa
@vdespa 4 месяца назад
Glad you think so! Thank you!
@hemantojha5154
@hemantojha5154 Год назад
Thanks for sharing this info. Also is it possible to share that file with the team in workspace?
@vdespa
@vdespa Год назад
Unfortunately this is not possible. You need to share files using existing collaboration tools such as Github, Dropbox or anything else that the team is using.
@yulianloaiza
@yulianloaiza 9 месяцев назад
It's possible to do so now
@hevertonvpMrwriters
@hevertonvpMrwriters 3 года назад
My backend has a 'FromForm' method witch is accepting all the data (including the file) but is actually ignoring the object im sending as json. Getting crazy here!
@vdespa
@vdespa 3 года назад
Is that valid JSON?
@hevertonvpMrwriters
@hevertonvpMrwriters 3 года назад
@@vdespa yes, it is. I forgot to mention that is a List of objects. I have an 'n to n' relationship between "song" and "artist", tryng to create a song passing 'artist[0].Name' but it sends an attribute from artists instead of song. My english is terrible, hope u undertand it
@vdespa
@vdespa 3 года назад
@@hevertonvpMrwriters I understand what you mean but i don't know how to help you
@hevertonvpMrwriters
@hevertonvpMrwriters 3 года назад
@@vdespa no problems, thanks anyway!
@myk4229
@myk4229 3 года назад
Hi, In the FormData I uploaded the valid excel file so for testing the 10 excel sheet which has all the invalid data how to use the different excel sheet using data driven testing.
@vdespa
@vdespa 3 года назад
It is hard to answer this with the given information. Join the Discord community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
@anonimanonim-mp9hx
@anonimanonim-mp9hx 2 года назад
Hey Valentin, how i can resolve nthe ext error. In Postman request with form-data works fine but if i try to send the same field in raw it return me the error. Please help :)
@vdespa
@vdespa 2 года назад
It is hard to answer this with the given information. Consider posting your question in the Postman community (community.postman.com/) and share what you have tried so far and where did you get stuck. Include screenshots and as many details as possible. Feel free to tag me with @vdespa. Thanks!
@anonimanonim-mp9hx
@anonimanonim-mp9hx 2 года назад
@@vdespa thanks but I’ve resolved my problem using by newman 🙂. Before I tried to use cypress for sending API requests.
@surajgaur4770
@surajgaur4770 Год назад
I want to send a json file, a image file and a list of image file, How do I do this? When I use form data and send the data it says '415 Unsupported Media Type'. Could you help me to short this out?
@itsm3dud39
@itsm3dud39 Год назад
did you find answer?
@surajgaur4770
@surajgaur4770 Год назад
@@itsm3dud39 yes I do.
@itsm3dud39
@itsm3dud39 Год назад
can you please tell me? i m also finding for that@@surajgaur4770
@khauvannam
@khauvannam Год назад
​@@surajgaur4770can u give me an answer, i still stuck with it
@surajgaur4770
@surajgaur4770 Год назад
@@khauvannam In postman goto body section inside it select form-data, there you can put images files by selecting one or selecting multiple file from win explorer at a time and for json data you need to put a json file, that's it.
@namaloompakistani1768
@namaloompakistani1768 3 года назад
hello you ther? need little help regarding res
@MrLamans07
@MrLamans07 2 года назад
life saver
@vdespa
@vdespa 2 года назад
I am glad to hear that. Thanks.
@amithtmhhh
@amithtmhhh 3 года назад
Hi Valentin. Instead of sending json body. I need to send the json file as body. Is this doable in postman?
@vdespa
@vdespa 3 года назад
Sure. Send the file as blob.
@BoguszMędykowski
@BoguszMędykowski Год назад
thankS!
@vdespa
@vdespa Год назад
You are welcome. Thank you for leaving a comment.
@MasharipovSaidbek
@MasharipovSaidbek 3 года назад
amazing
@vdespa
@vdespa 3 года назад
Thank you
@marivi6402
@marivi6402 2 года назад
Hello there, thanks for your video. In its regards.., I have a question, its because when every time I try to upload the file.png with the JSON data, the system returns to me this error: "message": "Content type 'multipart/form-data;boundary=--------------------------176346671772177422308137' not supported", How can I fix it, please?
@vdespa
@vdespa 2 года назад
Check the API documentation. It seems that this request is not supported.
@marivi6402
@marivi6402 2 года назад
@@vdespa you mean te post request for multipart file is not supported?
@vdespa
@vdespa 2 года назад
@@marivi6402 Yes.
@oraclematon9277
@oraclematon9277 2 года назад
it work~!
@vdespa
@vdespa 2 года назад
Great 👍
@SuperAzazel84
@SuperAzazel84 2 года назад
Thanks You help me :D
@vdespa
@vdespa 2 года назад
Happy to help
@lttp94
@lttp94 3 года назад
I send a request to upload the file, in the Console of Postman, the request body show that file undefined. Is there any problem?
@vdespa
@vdespa 3 года назад
Have you followed the steps in the tutorial? Can you see the contents of the file in the response?
@dimon.digital
@dimon.digital 2 года назад
same problem. I can't to make an upload image now. Requst Body always become undefined
@itschaitu24
@itschaitu24 3 года назад
May I know the code ..
@rohith_rkd
@rohith_rkd 2 года назад
How do i upload file to server instead of API url?
@vdespa
@vdespa 2 года назад
I am not sure I follow you. The API is on the server.
@rohith_rkd
@rohith_rkd 2 года назад
@@vdespa sir i mean to say there are no apis and you only have windows server-you have to upload files to a folder under c drive
@vdespa
@vdespa 2 года назад
@@rohith_rkd you may need an ftp server for this use-case.
@eitangrunseid3191
@eitangrunseid3191 2 года назад
how can I post a file but only it's content? I
@vdespa
@vdespa 2 года назад
What else does a file contain, apart from its content?
@eitangrunseid3191
@eitangrunseid3191 2 года назад
@@vdespa I mean that I don't have a file directory only the content, how can I send a CSV without having the file on a directory?
@vdespa
@vdespa 2 года назад
@@eitangrunseid3191 I am sorry, but I don't know what you mean. Maybe you can join the Discord community and ask your question there.
@khajamuhammad7372
@khajamuhammad7372 Год назад
Hi , Thanks for the content. I have a use case: to upload files to Share Point. I followed your steps and im able to upload. After uploading i tried to open the file but it shows error: "it looks like we dont support this file format" Can you please help to resolve the issue
@vladzh2639
@vladzh2639 Год назад
Hi. Thank you for video. can you help me? I have WebForm like Name, Last name, BirthDate and 10 more fields and browse Fhoto. How i must describe fields for body request? Content-Disposition: form-data; name="Name" ---------------boundary Content-Disposition: form-data; name="Last_name" ---------------boundary Content-Disposition: form-data; name="Date_birth" ---------------boundary ............... AND 10 more raws ---------------boundary Content-Disposition: form-data; name="Photo"; filename="picture.jpg" Content-Type: image/jpg LIKE THIS?????? Оr i can use JSON for describe fields? PS Sorry for my english))))
@sadanandpatil8230
@sadanandpatil8230 2 года назад
Hi, when I am sending my json data using form-data and keeping it in value part as you shown above but in my php code file_get_content(php://input) not accepting it... Could you plz help here
@vdespa
@vdespa 2 года назад
Does your $_POST variable contain the data you need?
@diogosilva8219
@diogosilva8219 2 года назад
lobe u thx
@vdespa
@vdespa 2 года назад
You are welcome. Thank you for leaving a comment.
@hafsadolly6830
@hafsadolly6830 Год назад
Not working
@vdespa
@vdespa Год назад
What is not working. Kindly let me know.
@yogeshpatil9642
@yogeshpatil9642 Год назад
Show ur code
@ryanmamboudjemtchemeu4289
@ryanmamboudjemtchemeu4289 Год назад
Thank you !
@vdespa
@vdespa Год назад
You're welcome!
@TheFfgo
@TheFfgo Год назад
thank you
@vdespa
@vdespa Год назад
You are welcome. Thank you for leaving a comment.
Далее
Data-driven testing using Postman
13:37
Просмотров 59 тыс.
POST Form Data as JSON with Fetch API in JavaScript
9:25
Песня РАСПУТИН на русском!🔥
00:56
What is a FormData Object
4:42
Просмотров 55 тыс.
Loop request based on data from response in Postman
13:13
Learn JSON in 10 Minutes
12:00
Просмотров 3,2 млн
How Fast Can I Fill My Inbox?
13:30
Просмотров 323 тыс.
Песня РАСПУТИН на русском!🔥
00:56