Upload local files using Google Colab

It sounds like third-party cookies may be disabled in your browser, see https://github.com/googlecolab/colabtools/issues/17.

The setting is under chrome://settings/content/cookies.


That text after upload button is very universal:

[ Choose Files ]   Upload widget is only available when the cell has been executed in the current browser session. Please rerun this cell to enable.

It is a text prepared for the case that you or other person will open the shared notebook from a browser in another computer or window. It remains displayed also if the upload widget is blocked due to some security or privacy protection. A significant error message box have been usually displayed before.

If you have run the cell recently from the same window then it is useless to rerun it if no setting have been fixed between.

tl;dr) File upload requires to enable third party cookies in Chrome (the answer above - Chrome settings / Conntent settings / Block third-party cookies and site data - uncheck). In Firefox is no solution known currently.


Chrome or new Firefox
If you have disabled third-party cookies you have seen this message box (It was displayed only once when any first output cell was displayed for the first time in the notebook, maybe at startup):

Error
Could not access the resources needed to display output.
This is probably because third-party cookies are not allowed by your browser.

  Details... [ V unfold to see details ]

   These details are similar:

Chrome: NotSupportedError: Failed to register a ServiceWorker: The user denied permission to use Service Worker
Firefox: SecurityError: The operation is insecure.

They expect that you remember it when you see much later a traceback with this internal error message. The traceback with MessageError is everytimes the same because it contains a copied error that come through pipe from javascript.

Chrome: MessageError: TypeError: Cannot read property '_uploadFiles' of undefined
Firefox: MessageError: TypeError: google.colab._files is undefined

 
Old Firefox 52 ESR (Extended Support Release - still with new security updates)
Colab site never reports currently an intelligible message box for humans in an old Firefox, only a traceback.


Colaboratory work relative acceptably also with disabled third-party cookies. I was in a temptation to ignore a message at start of notebook to prefer a standard privacy. I promise that I will never disable them if I want to easily upload a file or to cooperate together with someone other or dislike a wheel icon that remains sometimes rotating busy endless while nothing is running actually :-)


You can whitelist the following cookies in Chrome:

https://[*.]googleusercontent.com:443

I just had the same issue, so I restarted the Kernel and refreshed the page and the issue was gone. Hope that helps.