Ledge

Why your browser opens a file instead of uploading it

A web page only accepts a dropped file in the places its own code has set up to receive one. Drop a file anywhere else and the browser falls back to its usual job, which is opening files: the page you were on is replaced by your PDF or image, or the file is handed to Downloads. Press Command-[ (Command and the left square bracket) to go back, then drop again onto the page’s marked upload area, or use its upload button instead.

What actually happened

A browser can do two different things with a file. It can hand the file to a web page that asked for one, which is an upload. Or it can open the file for you to look at, the same as if you had double-clicked it and chosen the browser. When a drop lands somewhere the page is not listening, the second behavior wins.

The giveaway is the address bar. Instead of the site’s address, it starts with file:/// followed by a path on your Mac, such as file:///Users/yourname/Downloads/scan.pdf. That address means the browser is showing a file from your own disk. Nothing has been sent anywhere, and the original file is exactly where it was. Browsers display images, PDFs, plain text and many videos this way; for kinds of file they cannot display, some save a copy to Downloads and some do nothing at all.

Getting back to the page

  1. Press Command-[ or click the Back button. Do not reload the page.
  2. Check what survived. Many forms keep typed text when you go back, but a file you had already attached may need attaching again.
  3. If the file opened in a new tab rather than replacing the page, close that tab with Command-W and you are back where you started.

If you had typed a lot into a form before the drop, copy that text somewhere safe before you try again. Losing a paragraph to a missed drop once is annoying; losing it twice is worse.

Where to aim

Most missed drops come from the page not being ready, or from a target that is narrower than it looks.

  • Open the upload first. Many web apps only create a drop area after you click Upload, Attach or a paperclip icon. Before that, there is nothing on the page to catch the file.
  • Wait for the highlight. A page that accepts drops usually reacts while the file is over it: a dashed box lights up, the page dims, or a message such as “Drop files here” appears. If nothing changes under the pointer, keep moving until something does, or do not let go.
  • Stay away from the tab bar and the address bar. Dropping there tells the browser to open the file, which is exactly the result you are trying to avoid.
  • Let the page finish loading. A drop area that has not loaded yet cannot take a file.
  • Check what the site accepts. A page that wants images may ignore a PDF. Why an app refuses a file you drag onto it covers the same problem outside the browser.

If the drop keeps failing in the last moment even when you aim well, why drag and drop loses the file at the last second looks at the physical side of it.

The button route never misses

When a drop keeps going wrong, the upload button is slower but reliable. Click Choose File, Upload or whatever the page calls it, and the standard macOS open dialog appears.

Two shortcuts make that dialog quicker:

  1. Press Shift-Command-G, then paste or type the file’s path to jump straight to it.
  2. Or drag the file from a Finder window onto the dialog. The dialog jumps to that file and selects it, so all that is left is clicking Open.

The second one is a drop that is very hard to miss, because the dialog is a large target that exists only to receive files. Why the Mac file picker opens in the wrong folder explains why the dialog so often starts somewhere unhelpful.

Make the drop short

A lot of missed drops are long drags. The file is in a Finder window half hidden behind the browser, you pull it across the screen with the page covering what you need to see, and you let go a fraction too early. The fix is to have the file already waiting close to where you will drop it.

Ledge gives it that spot. When you download or export the file, drag it up to the notch at the top of the screen and let go; it lands on a shelf that drops from the notch and stays there. Later, open the upload page, click its upload button so the drop area is ready, then open the shelf with Option-Space or a click on the notch and drag the file down onto the highlighted area. The drag is short, and you are looking at the page the whole time.

The browser and the page still decide what happens to a drop, so the aiming advice above applies to a drag from the shelf just as it does to one from Finder. Ledge itself has no account and no cloud; the only upload is the one the web page makes when you drop the file onto it. On a Mac without a notch, the shelf sits at the top center of the screen. Getting a file into a web upload field fast covers more of this routine.

Questions

Did anything get uploaded when the browser opened my file?

No. A page whose address starts with file:/// is a view of a file on your own Mac. Nothing leaves the Mac until a web page receives the file through its own upload area or button.

Why does the same drop work on one site and not another?

Each site builds its own drop area, and some do not have one at all. On a site without one, every drop is a miss, and the upload button is the only way in.

Why is there a new copy of the file in Downloads?

Some browsers save a dropped file they cannot display, as if you had downloaded it. It is a copy; the original is still in its folder. You can delete the copy in Downloads without losing anything.