Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have been using Windows for a while, and with it there is a feature when you want to upload a photo (for example) to a website, you click on the "Choose File" in Chrome to upload a photo, a "File Explorer" opens, and instead of selecting a file from the hard drive you can paste a URL into the "File Explorer" and press open and it will download the file from the web to your temporary files, and use it to be uploaded.

Is there any way I can do that in Ubuntu 12.10?

Here is the windows example:
Upload from url via File Explorer

share|improve this question
    
What website? Also I don't understand if you want to download or upload a file to that website? Can you be more explicit? –  devius Dec 13 '12 at 15:41
    
The site is Facebook, in windows you can do this: howto.cnet.com/8301-11310_39-57496509-285/… and and press open, it will then upload the photo to the website, in this case, Facebook. –  Ryan Naddy Dec 13 '12 at 15:48
add comment

3 Answers 3

up vote 2 down vote accepted

This functionality is implemented by the operating system's Open File dialog. Actually the site or the browser you use doesn't matter because this is operating system specific.

Gnome Open File dialog used in Ubuntu doesn't support this feature, however, the File Open dialog used in KDE is able to open HTTP URLs. I'm not sure what is the situation with support in other other desktop environments that run on Ubuntu.

share|improve this answer
    
Just tested this in KDE - indeed, it works in KDE just fine. Nice, I didn't know about this feature. –  Sergey Dec 13 '12 at 20:34
    
So basically, if the OP really really wants this feature he must install KDE and use it instead of the standard Unity session. Probably not the answer most users are looking for, but it is possible. –  devius Dec 13 '12 at 21:30
    
Well, KDE, XFCE, LXDE are all still "Ubuntu", albeit they're not default desktop environments. It just doesn't feel right to start an answer to "Feature X works in Windows, does it work in Ubuntu" with a categorical "No." Switching DEs just for this feature may be an overkill although I have to tell that if somebody needs configurability, features and options then KDE is a DE to check. –  Sergey Dec 13 '12 at 21:42
    
Well I am using Unity's dialog, or what ever comes default with Ubuntu 12.10. Thanks for the help, it sounds like it is not possible with this File Dialog box. –  Ryan Naddy Dec 13 '12 at 22:59
add comment

And an obligatory command-line solution :) In the spirit of this answer: What is the command line equivalent of copying a file to clipboard? I wrote a simple Python script which accepts an URL to a resource as a parameter, downloads the file/page to a temporary location and copies the full file name to the clipboard. All that is left is to open Open File dialog and press Ctrl-V.

The script:

#!/usr/bin/python

import os, tempfile, argparse, urllib

parser = argparse.ArgumentParser(description="Download a file from an URL, save it as a temporary file and copy a link to the file to clipboard")
parser.add_argument("url", help="The URL of a file to download")
args = parser.parse_args()

filename = tempfile.mktemp()
urllib.urlretrieve(args.url, filename)
os.system("echo %s|xclip  -i -selection clipboard" % filename)
print("File %s has been copied to clipboard, now open a File dialog and press Ctrl-V." % filename)

To use, create a directory called bin in your home directory, put the script there (I named it gimme) and set executable permission on it:

chmod +x ~/bin/gimme

Ahh, and you'll need xclip for it to work:

sudo apt-get install xclip

And here's how to use it:

gimme http://askubuntu.com/questions/228667/upload-file-from-url
File /tmp/tmpFXs7_S has been copied to clipboard, now open a File dialog and press Ctrl-V.
share|improve this answer
add comment

I am not sure whether this will work. To copy the path, Press ctrl + L in nautilus, then copy it. Try it :)

share|improve this answer
    
Nothing happens when I press Ctrl+L –  Ryan Naddy Dec 13 '12 at 15:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.