-1

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.

Akhil
  • 443
  • 1
  • 9
  • 29

1 Answers1

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.

  • 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