Files are kept in server folder with names data/DIR Images/Img1.jpg
. when http request is sent from chrome browser, am able to download the file. But in Firefox file is getting downloaded without extension. data/DIR
only its saving.
Asked
Active
Viewed 579 times
-1

Akhil
- 443
- 1
- 9
- 29
-
And how are you triggering the download? An HTML download link? Javscript? Something else? – Lewis Apr 01 '19 at 10:21
-
java script 'window.open' – Akhil Apr 01 '19 at 10:22
1 Answers
1
You can use URL encoding , if you are calling from javascript.
For example:
var uri = "download.asp?path=data/DIR Images/Img1.jpg";
var downloadURI = encodeURI(uri);
you will get the URL as
download.asp?path=data/DIR%20Images/Img1.jpg
The encoded url will work fine.

Siva Kalidasan
- 119
- 6
-
encodeURI am doing before window.open. But only problem is with Firefox browser. Chrome am able to download. in firefox file is getting downloaded without file extension along from %20 name is trimming off. – Akhil Apr 01 '19 at 12:23
-
You can try using encodeURIComponent() - to encode params , Please check this https://stackoverflow.com/questions/75980/when-are-you-supposed-to-use-escape-instead-of-encodeuri-encodeuricomponent – Siva Kalidasan Apr 01 '19 at 12:31