Spaces replaced by underscores (and worse)

Hi there,

I have MP3 links on a webpage, and want a ‘Download’ button instead of the users having to right-click, then select ‘Save Target As’.

Next to the MP3 links I have placed links to an agent that does the following:

Dim session as NotesSession

etc

Dim xFileName As String

'Hardcoded MP3 name for time being:

xFileName=“Garuda4D: RTP Slot 2024 Yang Sedang Trending Di Indonesia Berserta Pola Untuk Meningkatkan Kesempatan Menang

Print|Content-Type:application/download|

Print |content-disposition: attachment; filename=| + xFileName

Print | location.href(| + xFileName + |) |

According to the Microsoft document: http://support.microsoft.com/kb/q260519/ this should ‘Raise a “File Download” Dialog Box’, which it does, but some of the characters in the URL presented to the user are altered so that ‘://’ becomes ‘___’, all spaces also become underscores as do all forward slashes.

This prevents the file being downloaded, and even if the corrupted characters are replaced by the correct ones, the download dialog has taken the size of the file to be approx 10% of what it is, so garbage is downloaded.

In terms of possible solutions, in addition to the above two lines I have also used all possible combinations of:

Print |Content-type: audio/mpeg|

Print |Content-type:application/force-download|

Print |content-type: application/octet-stream |

Print |Content-Transfer-Encoding:base64|

Has anyone seen this before? Any suggestions gratefully received!

Cheers,

Jimmy

Subject: Have I searched the forums?

Yes I have - the Domino 4&5 Forum, the 6&7 Forum and this one!

Subject: End of a long day…

Doh! It was the end of a long day when I wrote my original posting.

Of course the answer to the underscores issue was to use URL encoding, but unfortuantely there is more to the issue now!

Anyway, here is what I have now:

Dim xFileName As String

'Hardcode for now	

xFileName="http%3A%2F%2Fwww.mymusicsite.com%2Fsc%2Fmymusicsite.nsf%2FvCMS%2FSampleTracksCMS%2F$file%2FWorld.mp3



Print |Pragma: public|

'Use this for time being:

Print |Expires:Thu, 21 Oct 2010 16:00:00 GMT|

Print |Cache-Control: must-revalidate, post-check=0, pre-check=0| 

Print |Cache-Control: private|,False

Print |Content-Disposition: attachment; filename="| + xFileName + |"| 

Print|Content-Type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3| 

Print |Content-Transfer-Encoding: binary| 

'Hardcode for now

Print |Content-Length: 1749913|

…but for the actual file download I need to stream the contents of world.mp3 which is held as an attachment. Due to restrictions, I cannot write to the file system. So what the issue boils down to now is:

It is possible to stream a file attachment (in this case MP3) as binary data when it is attached as a document, when it is not possible to save it to the file system?

Any pointers or hints gratefully received!

Cheers,

Jimmy

Subject: Domino server does support bytestreaming of files

but when you attach the file, you have to make sure you do not have the compress option selected. Be aware though, byte streaming is not the same as media streaming.