Linking to an MP3 file


#1

Hello all,

This is my second post, never got a single answer on the first one, so hopefully I will be luckier with that one so here goes;

I am trying to embed a Google Reader MP3 Player into a wordpress page as suggested here http://www.labnol.org/internet/design/html-embed-mp3-songs-podcasts-music-in-blogs-websites/2232/
.
I uploaded some MP3 files in a directory using Filezilla named username@moran.dreamhost.com/oursite.org/Media/MP3/mp3filename.mp3 and I’m trying to add a needed link to the code. When I use the Filezilla “Copy URL to clipboard” function I get something like this;
ftp://username@moran.dreamhost.com/oursite.org/Media/MP3/mp3filename.mp3. When I try to add that URL in the code it doesn’t work. Can someone please point out what I’m doing wrong please?

Thanks


#2

[quote]I uploaded some MP3 files in a directory using Filezilla named username@moran.dreamhost.com/oursite.org/Media/MP3/mp3filename.mp3 and I’m trying to add a needed link to the code. When I use the Filezilla “Copy URL to clipboard” function I get something like this;
ftp://username@moran.dreamhost.com/oursite.org/Media/MP3/mp3filename.mp3. When I try to add that URL in the code it doesn’t work. Can someone please point out what I’m doing wrong please?[/quote]
There are different types of URLs and you are using the wrong type.

In particular, the URL you what is an HTTP URL indicated by the scheme identifier http:// so that the file can be accessed from the Web via the HTTP protocol.

The URL you got from Filezilla is for the FTP protocol as indicated by ftp:// scheme identifier and of course to use such a URL requires the person to login to your FTP account using your username and password… just like you did with Filezilla yourself. But that is obviously not the way to go here. Generally one would publish this type of URL for an FTP site that is open to the public or that you know the person will have their own FTP account and permission to access the file. Neither applies in your situation.

Customer since 2000 :cool: openvein.org


#3

I just looked at your unreplied-to post and Atropos7’s comments above apply to that as well :wink:

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#4

Thank you for the reply, this is much appreciated.

Then what is the correct way to proceed to have a file, wether it might be an image or an MP3 or a PDF, available to my site visitors so I could add a working link to this file? You’d think I would easily find the answer to this but I cannot seem to do so for whatever reason. If anyone could provide a link or a working example that would help lifting my newbie fog.

Thanks again


#5

The correct way depends on what you have to work with.

Web browsers are what you call client software. If you use the term ‘Web’, you are talking about the HTTP protocol, and URLs that start with http://, and your “web browser” is what is called an HTTP client. Thus if you put something on the Web, you then tell other people how to get it by saying ‘http://domain/path/file’, and they can use their web browser to get it.

But hold on! Another protocol is FTP, and thus you need FTP client software to use it. While Filezilla is an FTP client, you should be aware that most desktop web browsers are both HTTP and FTP clients. Thus on web pages when a link is to an FTP site (ftp:// URLs remember!) your web browser will be able to download the file for you.

As I mentioned these FTP URLs are not suitable for your purposes because you don’t have an FTP server that won’t require a username and password. So that leaves you with HTTP URLs that link to your web site - there is no requirement for a username and password in order to download a file from the web site. More importantly in your situation you have to take into account whether an FTP or HTTP URL is required when an application asks for a URL. Yeah, you know that Firefox/Opera/Safari/Chrome/MSIE will do both, but did you notice the media player that you want to use doesn’t mention which type to use? It could turn out that only HTTP will work and FTP won’t. If documentation doesn’t mention a particular scheme (ie ftp:// or http://) it is safe to try an HTTP URL first.

As for as making an HTTP URL it’s rather easy if you’re talking about linking to a file with no frills. You already know it will beginning with http://domain/ and that your home directory is /home/username and the web files are in /home/username/domain/ (called web directory) right? Well your web site works by trying to match the url-path to a file path. The url-path starts with the first slash after your domain, thus for http://example.com/ it is simply /. So to find a file we take /home/username/example.com and prepend that before the first slash, getting /home/username/example.com/. So in your case:

file path: /home/username/oursite.org/Media/MP3/mp3filename.mp3
web directory: /home/username/oursite.org/
HTTP ‘root’ URL: http://oursite.org/
(now swap web directory for HTTP ‘root’ URL in file path - ie mapping)
HTTP URL: http://oursite.org/Media/MP3/mp3filename.mp3

Note that I added a trailing slash to the web directory. That is used to indicate it is a directory and not a file. Sometimes it is not needed because it is assumed you are only giving a directory name and never a filename. Usually documentation will point out if a trailing slash is needed or not in a file/directory path. (HTTP url-paths are not necessarily file/directory paths; they get ‘mapped’ to one if there is no special action to be taken)

Customer since 2000 :cool: openvein.org


#6

[color=#CC0000]ftp://username@moran.dreamhost.com/[/color][color=#0000CC]oursite.org/Media/MP3/mp3filename.mp3[/color]

[color=#00CC00]http://[/color][color=#0000CC]oursite.org/Media/MP3/mp3filename.mp3[/color]

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#7

Hello Atropos7

I tried to do it the way you suggested and it worked… but not with the player I was trying to use. After several unsucessful tries I tried it with the Yahoo player mentionned on the same page using the same link (that is in the format outlined in your reply), and lo and behold it worked! I feel like I just overcame a major hurdle thanks to you.

Thank you so very much!