play musicfile stored on server in webaudiocontrol


I can play a mp3 file via a URL using the webaudiocontrol.

What I try to do now is to upload a .mp3 song to the server and play it with the webaudiocontrol.
I think that I have to upload the file and convert the uploaded file to a webfile so that I can access it using a URL ?

I can upload a .mp3 to the server - but I get an invalid URL when I convert the uploaded file into a webfile.
So here is my code (I try to play a file that is already on the server):

[code]dim mp3 as WebFile
dim f as FolderItem

f = New FolderItem(“c:\Uploads\test.mp3”)

If f <> Nil And f.Exists Then

mp3               = WebFile.Open(f)          'Converts the passed FolderItem to a WebFile that can be downloaded
'mp3.ForceDownload = false  'When True, the browser will always download the file rather than try to display it

AudioPlayer.MP3URL =mp3.URL  'the webaudioconreol disappears in browser (probably due to a bad URL)
'showurl (mp3.URL)            'Browser shows "the requestred URL .... could not be found" / 404: File Not Found

MsgBox (“Error”)
end if[/code]

[quote]Browser’s URL:{6896-0706-1867-3369-5335}/test.mp3

Browser Error:
The requested URL “/0F98B5C4258CE9ADE62087494CB4D314/files/%7B6896-0706-1867-3369-5335%7D/test.mp3” could not be found. Please check your request and try again.[/quote]

So my question:
How would I convert a uploaded file (a file that exists on the server’s filesystem) so that webaudiocontrol can play it ?

thank you

Try putting the WebFile as a property instead. It might go out of scope directly after you’ve created it.

thanks, I made it a property of app - and now it works…