# Getting filename from the download URL

**URL:** <https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502>\
**Category:** API and Webhooks\
**Created:** [March 10, 2020, 4:34am UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502 "2020-03-10T04:34:55Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![kchan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kchan/32/3397_2.png) [@kchan](https://devforum.zoom.us/u/kchan)\
**Post date:** [March 10, 2020, 4:34am UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/1 "2020-03-10T04:34:55Z")

</div>

Folks, we’re trying to use the API to download the resulting video files but we’re having an issue assigning the proper filename.

Looking at the headers of download request for a vtt file we see:  
Content-Disposition: attachment;filename=…

For video files we see:  
Content-Disposition: attachment

Is that due to a redirect? We see what looks like the filename in the Location header.  
Location: [https://ssrweb.zoom.us/cmr/replay](https://ssrweb.zoom.us/cmr/replay) …

Any suggestions as to how to download the file w/the correct filename?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [March 10, 2020, 4:16pm UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/2 "2020-03-10T16:16:25Z")

</div>

Hey @kchan,

Please share what endpoint you are using, as well as steps to reproduce the issue.

When you say filename, what do you mean? The download\_url? Can you please share the download URL you are trying to use (feel free to private message it to me).

What is your use case for getting the filename from the URL?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![kchan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kchan/32/3397_2.png) [@kchan](https://devforum.zoom.us/u/kchan)\
**Post date:** [March 10, 2020, 7:41pm UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/3 "2020-03-10T19:41:14Z")

</div>

Yeah, that’s it. Ultimately we need to know the filename so we could reference it later and associate it with the meeting owner.

I was hoping to find an alternative to grepping the header (in different ways based on type of file) to assign a name of file. I guess web browsers are smarter at parsing through the headers coming across, offering a correct name to do the save as …

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [March 10, 2020, 9:55pm UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/4 "2020-03-10T21:55:38Z")

</div>

Hey @kchan,

This stackoverflow answer might help:

> <https://stackoverflow.com/questions/9744973/is-there-a-way-to-give-a-specific-file-name-when-saving-a-file-via-curl/9745079#9745079>

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![kchan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kchan/32/3397_2.png) [@kchan](https://devforum.zoom.us/u/kchan)\
**Post date:** [March 10, 2020, 10:15pm UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/5 "2020-03-10T22:15:18Z")

</div>

It mentions  
If you want to preserve the original file name from the remote server, use the `-O` option.

e.g. ```  
curl -O [http://url.com/file.html](http://url.com/file.html)

```auto
Doing a 
curl -O -L https://hawaii.zoom.us/rec/download/uZIvJu-h-z03EtHDsgSDAadxW9S5f6Os1ihL__cOmRvkVCVVOgKlbrAbard68ha8UjTsTkS6wGINKiPA

results in a saved file named 'uZIvJu-h-z03EtHDsgSDAadxW9S5f6Os1ihL__cOmRvkVCVVOgKlbrAbard68ha8UjTsTkS6wGINKiPA'

so now I realize that -O is naming 'uZIvJu-h-z03EtHDsgSDAadxW9S5f6Os1ihL__cOmRvkVCVVOgKlbrAbard68ha8UjTsTkS6wGINKiPA' .. cause that's the "named" filename from the download URL.
```

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [March 10, 2020, 10:19pm UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/6 "2020-03-10T22:19:16Z")

</div>

Hey @kchan,

Nice catch. You could also rename that if you needed to.

Did you accomplish what you needed?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![kchan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kchan/32/3397_2.png) [@kchan](https://devforum.zoom.us/u/kchan)\
**Post date:** [March 12, 2020, 6:32pm UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/7 "2020-03-12T18:32:08Z")

</div>

_Did you accomplish what you needed?_

Not really. I’ll need to make one curl request to download the headers from the download URL, parse it to get the info we need (the real name of file), then do another fetch to download and correctly name the file. Maybe I could do it in one fetch, but it’s still hunt for the filename then rename.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [March 12, 2020, 8:44pm UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/8 "2020-03-12T20:44:32Z")

</div>

Hey @kchan,

I see, can you use the [cloud recording id property in the cloud recording API](https://marketplace.zoom.us/docs/api-reference/zoom-api/cloud-recording/recordingslist) or [webhook](https://marketplace.zoom.us/docs/api-reference/webhook-reference/recording-events/recording-completed) to rename the file?

> <https://stackoverflow.com/questions/9744973/is-there-a-way-to-give-a-specific-file-name-when-saving-a-file-via-curl/9745079#9745079>

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![ssnukala](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ssnukala/32/11894_2.png) [@ssnukala](https://devforum.zoom.us/u/ssnukala)\
**Post date:** [July 18, 2020, 5:06am UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/9 "2020-07-18T05:06:20Z")

</div>

> [@tommy](#):
>
> Is there a way to give a specific file name when saving a file via cURL?

@kchan quote=“tommy, post:8, topic:8502”]  
Is there a way to give a specific file name when saving a file via cURL?  
[/quote]  
@kchan  
I am trying to do the same but when i read the headers i don’t get the file name, getting a lot of other info. Can you please share your code that is used to get the original Zoom file name.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 22, 2020, 7:01am UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/10 "2020-07-22T07:01:34Z")

</div>

Hey @kchan,

Have you tried this stack overflow answer to come up with your own file naming convention?

> <https://stackoverflow.com/questions/9744973/is-there-a-way-to-give-a-specific-file-name-when-saving-a-file-via-curl/9745079#9745079>

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![kchan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kchan/32/3397_2.png) [@kchan](https://devforum.zoom.us/u/kchan)\
**Post date:** [July 22, 2020, 6:08pm UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/11 "2020-07-22T18:08:20Z")

</div>

Sorry for the late reply. I forgot my question was still floating out there. We’re still finding out the filename via headers. I vaguely remember that we need to do two different approaches (searching) based on the kind of file.

However the issue that I had about not having the correct headers, initially was due to authentication. For most things we’d send authentication as part of the header packet (instead of part of the URL). For downloads you don’t include authentication as part of the header packet.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 24, 2020, 9:09pm UTC](https://devforum.zoom.us/t/getting-filename-from-the-download-url/8502/12 "2020-07-24T21:09:57Z")

</div>

Thanks for the info @kchan! 🙂

-Tommy
