How do I link directly to uploaded files?

I have uploaded some files (images) which I’d like to link in my own site as well as other places, but usually I try to host a different resolution of the same image to show up on other sites.
My problem with wordpress right now is that if I upload the file to WordPress’ upload directory through FTP, I don’t see the file show up in my media (in WP-admin). I can get a link from my ftp client (cyberDuck) but it doesn’t actually link me to a working link, also the link is something like this:

http://ftp.mydomain.com/really-link-file-name-with-20%-and-at-the-end-its.jpg

So I assume it works like that b/c it contains jpg at the end but it doesn’t work and takes me to a 404 page.
Any ideas of how I can go about uploading through an FTP client and get those files to show up on wordpress and also link correctly?

Related posts

Leave a Reply

6 comments

  1. If I upload the file to WordPress’ upload directory through FTP, I don’t see the file show up in my media (in WP-admin)

    Try to avoid directly uploading via FTP. WordPress doesn’t scan your uploads folder for new images. Instead, use the built-in media uploader within WordPress to upload images. WordPress will automatically place them in the correct folder, create downsized versions you can use in a quick gallery or client sales page, and store the image’s meta information in the WordPress database.

    The Media Gallery pulls its information from the WordPress database, so to see your uploaded images here, this is the only way to do it!

    I can get a link from my ftp client (cyberDuck) but it doesn’t actually link me to a working link

    Your client is giving you an FTP link. If you use an FTP link in a web browser like Internet Explorer (i.e. ) your browser will act like an FTP client and try to download the image rather than displaying in in the browser. What you need is an actual HTTP link, which you can get from WordPress if you uploaded through the Media Gallery.

    If you uploaded directly via FTP, your link would still be something like http://www.mydomain.com/wp-content/uploads/2010/11/something-something.jpg if you uploaded to the /wp-content/uploads/2010/11/ directory. If you put it somewhere else, change the link accordingly.

    To Review

    The correct way to add images to WordPress and get the links is through the Media Gallery:

    1. Log in to WordPress
    2. Go to Media ยป Add New
    3. Select your image and upload it to WordPress
    4. Set meta data as appropriate (Title, Caption, Alt Text, Description)
      • If necessary, you can Edit the image as well (rotate, crop, scale)
    5. Highlight the File URL and copy-paste it somewhere where you’ll remember it. This is the URL to the full-size image that you can link to from other places.
  2. What’s with that url? Its possible but confusing, did you install wordpress on a sub-domain named ftp or redirect the media folder to point there?

    Use
    ftp: //ftp. mydomain.com/whatever.jpg

    Or
    http:// www. mydomain.com/whatever.jpg

    The easiest way is to just log into wordpress–>click Media–>upload a photo and copy the direct url to the image.

  3. Two separate issues here:

    • in your FTP client you see [part of] real directory structure of your server, but your site works like web server sees it (focuses on site’s root directory, not server’s). To get working link you need to upload files in directory available to web server and use path relative to site root in URL;

    • files uploaded directly are not picked up by WP media library. For that to happen you need either use WP media upload functionality or import media using some plugin that can do that (I only remember W3 Total Cache by name, that does that for better CDN support functionality).

  4. WordPress has the ability to automatically resize images you upload and will keep the different resolutions in the uploads directory. So instead of uploading different resolutions of the file through ftp, I would upload the original resolution of the file and let WordPress create the different sizes you need.

    By default, WordPress will store 4 image sizes: thumbnail, medium, large, and original. You can define these sizes in the admin under Settings -> Media. If you need more sizes than that, you can define more in a plugin or in your theme’s functions.php by using the add_image_size() function:

    add_image_size('my_new_size', $width, $height, $should_crop);
    

    You can find more on this function in the codex: http://codex.wordpress.org/Function_Reference/add_image_size