Is there any way to get file name without downloading it?

Hey there I just want to get file name without downloading the file ? Is there any way to do it ? I know we can just split the Url and then get it but its not it means not every link contains file name right ? Some link use headers and there is no way to get headers in MIT app inventor ? So how can I get the file name by the help of headers without downloading the file ?

Provide some example urls to demonstrate what you mean...

If using google drive, you could call a google apps script to return the filename using the fileId in the url...

like this :

I know it have file name on it but still many of them dont contains and they all provides header like here its header is :

{'Date': 'Thu, 08 Dec 2022 10:33:06 GMT', 'Content-Type': 'video/mp4', 'Content-Length': '11477289', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*', 'Cache-Control': 'public, max-age=86400', 'Content-Disposition': 'attachment; filename=Christmas - 141704.mp4', 'access-control-max-age': '86400'}

As you can see it contains Content-Disposition header which have filename=Christmas - 141704.mp4

"Link has expired"

check this out :

Run the URL through a text reverse block then use the Taifun parse procedure with prefix ? and suffix /.
Reverse the result and undo any URL encoding.

For pixabay you may want to look at their RESTful api...

It maybe you will have to take a similar approach for other providers

Well i am trying to get file name form header : this one here it did't have any file name ... but if you make a head request then you can see filename in it ...

Nop its not working too means it only provides name on the link ....

but i solved it thanks for everyone i just create new extension to get the headers of the url and then get the data from there :+1:

Here it is : com.maiis.utils.myutils.aix (66.1 KB)


I get this runtime error when testing in companion




Here an old extension: KIO4_Terminal.aix

Can you try

curl -X HEAD -I

to get HEAD?

Extension_Terminal.aia (19.3 KB)


fixed download from here :

com.maiis.utils.myutils.aix (67.4 KB)

OK it works now (without runtime error) :slight_smile:

Does a good job of returning the filename somewhere in the headers returned from a google drive file ID.

I fed the header block with a url to an image from my own server (Apache).

This returned the header, although it did not contain the filename ? I know the filename is in the url, but was expecting to see it in the header...


possible that my Apache settings are blocking this / or just not required because of the filename being in the url.

Please remember the naming conventions...

onRequestComplete should be OnRequestComplete or just rename the event to GotHeader


1 Like

yup well not all url contains file name on headers, but i will add a different block on next update where if file name is on url then it return that else it will try to find it on header :+1: , And also it make head request on server to get header but i will try to add different things on next update sure to get file name and size or other data too ...

Thanks, I am new at extension creating :sweat_smile: but I will change it very soon ...

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.