dafriskymonkey
dafriskymonkey

Reputation: 2189

How do I access uploaded files on Microsoft Azure websites?

I wanted to upload some audio files to my azure [ASP.NET] website. I then came up with this idea: I created a WebAPI action responsible for uploading the audio files into an UploadedAudio folder that I created inside the Content folder (wich is a public folder, right?). Everything is working just fine in Debug mode.

After publishing to Azure, I can see that the files are persisted with paths like D:\home\site\wwwroot\Content\UploadedAudio\5ab46baa-ffa7-4b7f-bbb9-9d0c53fa0751.mp3, but I'm not able to play them like I can in Debug mode, because I get a NotFound error. Here is the URL that I use https://mywebsite.azurewebsites.net/Content/UploadedAudio/5ab46baa-ffa7-4b7f-bbb9-9d0c53fa0751.mp3. In Debug mode, http://locahost:port/Content/UploadedAudio/5ab46baa-ffa7-4b7f-bbb9-9d0c53fa0751.mp3 is working fine!

How can I access the uploaded audio files?

I hope that my problem is clear enough. If someone can help me with this...

Thanks.

Upvotes: 3

Views: 250

Answers (1)

dafriskymonkey
dafriskymonkey

Reputation: 2189

Got it !! adding these lines to the web.config is the solution:

<system.webServer>
<staticContent>
  <mimeMap fileExtension=".mp3" mimeType="application/octet-stream" />
</staticContent>

Upvotes: 1

Related Questions