# Get pdf with GET and POST the file in next request

**URL:** <https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951>\
**Category:** Help Hub\
**Created:** [November 22, 2021, 4:41am UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951 "2021-11-22T04:41:39Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![myrso](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@myrso](https://community.postman.com/u/myrso)\
**Post date:** [November 22, 2021, 4:41am UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/1 "2021-11-22T04:41:40Z")

</div>

I’m having trouble using the file from a GET request and then sending the file in the next POST request. It’s a pdf file if that makes any difference.

I can also access the pdf file by URL, so it would be easiest if I could specify a URL for the file data, instead of a locally saved file.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/4/9/49dd6f2592c146b6717bc3f6664206cee3f41df7.png)

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![Gbahdeyboh](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/gbahdeyboh/32/10420_2.png) [@Gbahdeyboh](https://community.postman.com/u/Gbahdeyboh)\
**Post date:** [November 22, 2021, 10:48am UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/2 "2021-11-22T10:48:22Z")

</div>

Hi @myrso.

You can specify the `URL` of the file in the address bar and send a `GET` request to the file without doing anything else.

What errors do you get when you send the `POST` request in the screenshot you shared?

---

<div class="post-metadata">

**Author:** ![myrso](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@myrso](https://community.postman.com/u/myrso)\
**Post date:** [November 22, 2021, 2:40pm UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/3 "2021-11-22T14:40:38Z")

</div>

Hello. Thank you for the response. I am successfully getting the file with GET, but then need to use that same file in the next POST request (ideally without downloading the file locally). The error I am getting when I try to end the POST request is:

{

“code”: 3660,

“message”: “No file found in the request. Please include a file and try again.”

}

---

<div class="post-metadata">

**Author:** ![Gbahdeyboh](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/gbahdeyboh/32/10420_2.png) [@Gbahdeyboh](https://community.postman.com/u/Gbahdeyboh)\
**Post date:** [November 23, 2021, 4:26am UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/4 "2021-11-23T04:26:10Z")

</div>

If I understand you correctly, what you are trying to do is to upload a file to a server using the URL of the file directly on Postman.

This is an interesting use case, but I do not think Postman currently supports it.

Ideally, when you upload a file using `form-data` or `binary` over an HTTP request, what you send is a `blob` or a `base64` string of the file. Postman makes this more convenient by allowing you to select a file locally and does the conversion for you when you make a request.

I am guessing that you are using this file in an automation flow which is why you want to avoid downloading it locally?

My solution might be quite hacky but it works. It involves you first converting the file to `base64` when it is fetched, then you save this in your environment. You can then retrieve this `base64` string from your environment when you want to upload it.

1. Create an environment for this and add a convenient variable name. In my case, I used `filebase64`.

 ![Screenshot 2021-11-23 at 5.16.44 AM](https://us1.discourse-cdn.com/getpostman/original/3X/4/b/4bd7f608811b33f31989c92dfd666bfdbafddbbb.png)

1. Send a `GET` request to the image and add some postman scripts to the `Test` tab which runs after the file has been fetched. The script simply gets the `base64` of the file using the `dataURI` method and saves it in the environment.

```javascript
const image = pm.response.dataURI()

pm.environment.set("filebase64", image);

```

 ![Screenshot 2021-11-23 at 5.21.42 AM](https://us1.discourse-cdn.com/getpostman/original/2X/b/be9ddcb203c64ed8a36837292321ab4dac7cbe40.jpeg)

NOTE: Don’t forget to toggle the right environment by the top right.

Now, each time you fetch a file, it gets the `base64` equivalent text of that file and saves it as an environment variable.

1. `Post` the `base64` text saved in your environment to your server.

 ![Screenshot 2021-11-23 at 5.23.48 AM](https://us1.discourse-cdn.com/getpostman/original/2X/2/246a93321dd5508edaf75ac7cd05b28c583eb4c1.png)

You will notice that this `base64` text is in the echoed response, which means it got sent.

I created a public collection for this example. You can check it out [here](https://www.postman.com/warped-water-156224/workspace/gbahdeyboh/request/5078742-596e3551-3ac2-4104-92f1-6f0d03bf63c8).

Let me know if it works for you!

---

<div class="post-metadata">

**Author:** ![myrso](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@myrso](https://community.postman.com/u/myrso)\
**Post date:** [November 23, 2021, 4:57am UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/5 "2021-11-23T04:57:27Z")

</div>

Thank you!!!, I will try this tomorrow. What would be theoretical maximum PDF file size be using this method? I imagine there is a limit to the max string length for variables?

---

<div class="post-metadata">

**Author:** ![Gbahdeyboh](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/gbahdeyboh/32/10420_2.png) [@Gbahdeyboh](https://community.postman.com/u/Gbahdeyboh)\
**Post date:** [November 23, 2021, 5:07am UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/6 "2021-11-23T05:07:46Z")

</div>

Greeaaatt!

Let me know however it goes.

The maximum payload size should be mostly dependent on the server. Some servers default to 100kb, but it can be increased. Postman allows you to send up to 50MB by default, but this can be increased in the settings tab.

I do not know if there is a limit to how much data can be stored in an environment variable, but I did a quick search and saw someone who stored over 200kb which is quite good.

---

<div class="post-metadata">

**Author:** ![myrso](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@myrso](https://community.postman.com/u/myrso)\
**Post date:** [November 23, 2021, 7:51am UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/7 "2021-11-23T07:51:35Z")

</div>

I gave it a try, but I’m getting the following error:

{“code”:2945,“description”:“MORE\_THAN\_MAX\_LENGTH”}

The API I am using is [https://www.zoho.com/creator/help/api/v2/upload-file.html](https://www.zoho.com/creator/help/api/v2/upload-file.html)

---

<div class="post-metadata">

**Author:** ![myrso](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@myrso](https://community.postman.com/u/myrso)\
**Post date:** [November 23, 2021, 8:09am UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/8 "2021-11-23T08:09:09Z")

</div>

I gave it a try, but I’m getting the following error:

{“code”:2945,“description”:“MORE\_THAN\_MAX\_LENGTH”}

The API I am using is [https://www.zoho.com/creator/help/api/v2/upload-file.html](https://www.zoho.com/creator/help/api/v2/upload-file.html)

---

<div class="post-metadata">

**Author:** ![Gbahdeyboh](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/gbahdeyboh/32/10420_2.png) [@Gbahdeyboh](https://community.postman.com/u/Gbahdeyboh)\
**Post date:** [November 23, 2021, 9:45am UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/9 "2021-11-23T09:45:22Z")

</div>

What is the size of the file you’re trying to upload?

---

<div class="post-metadata">

**Author:** ![myrso](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@myrso](https://community.postman.com/u/myrso)\
**Post date:** [November 23, 2021, 4:51pm UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/10 "2021-11-23T16:51:23Z")

</div>

39kb, but it will be different for each request.

---

<div class="post-metadata">

**Author:** ![Gbahdeyboh](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/gbahdeyboh/32/10420_2.png) [@Gbahdeyboh](https://community.postman.com/u/Gbahdeyboh)\
**Post date:** [November 23, 2021, 5:58pm UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/11 "2021-11-23T17:58:22Z")

</div>

This seems like a Zoho specific error rather than a Postman error.

I checked the API link you sent and I see that the Zoho API allows you upload a file as a multipart/form-data by specifying it’s URL.

In the sample collection I shared, I think you can just update the variable to the image URL and it should work.

 ![Screenshot 2021-11-23 at 6.57.08 PM](https://us1.discourse-cdn.com/getpostman/original/3X/2/0/20449f2fa4b802782667c8206155e6f082f5d4ad.png)

I might be wrong. I haven’t worked with the Zoho API before. But that is what it seems like to me.

---

<div class="post-metadata">

**Author:** ![myrso](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@myrso](https://community.postman.com/u/myrso)\
**Post date:** [November 23, 2021, 6:25pm UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/12 "2021-11-23T18:25:35Z")

</div>

Hi, regarding “Zoho API allows you upload a file as a multipart/form-data by specifying it’s URL.”. Where did you see this documentation? I have tried many times without luck.

---

<div class="post-metadata">

**Author:** ![Gbahdeyboh](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/gbahdeyboh/32/10420_2.png) [@Gbahdeyboh](https://community.postman.com/u/Gbahdeyboh)\
**Post date:** [November 23, 2021, 7:08pm UTC](https://community.postman.com/t/get-pdf-with-get-and-post-the-file-in-next-request/29951/13 "2021-11-23T19:08:03Z")

</div>

I saw it [here](https://www.zoho.com/creator/help/api/v2/upload-file.html).

 ![Screenshot 2021-11-23 at 8.05.40 PM](https://us1.discourse-cdn.com/getpostman/original/3X/0/6/063b537f35e4bb87107d42d0ed8881fe2b4d88f8.png)
