4

In my content script, I want to monitor which file a is getting uploaded to a web application.

I monitor "change" event for any "input:file" element. It works on any site (such as Gmail) that uses "input:file".

However sites like imgur, use SWFUpload mechanism. I tried to capture "fileQueued" event on element that I suspected to be swfupload. But that did not work.

  • How can I capture file upload event for sites that use swfupload?
  • Are there any other plugins that manage file uploading that I would need to take care in my content script?
  • Is there any generic mechanism to tackle this problem?

(I am aware of drag-n-drop mechanism, but I have not handled that case so far. I have also read following relevant question on SO:

Grab file with chrome extension before upload)

Community
  • 1
  • 1
Methos
  • 13,608
  • 11
  • 46
  • 49
  • Common file upload methods would be drag and drop/file api (html5), background iframe, flash uploader, silverlight uploader. You'll probably have issues detecting the last three. – Kerry Liu Jan 14 '14 at 14:58

1 Answers1

0

It's probably worth your time to experiment with the chrome.webRequest API; it appears that the onBeforeRequest event contains info about file uploads. It's a complex API with extra parameters to addListener; read the docs thoroughly.

Pixievolt No. 1
  • 780
  • 4
  • 15
  • Except that it doesn't include requests from plugins such as Flash. – Rob W Jan 23 '14 at 12:09
  • I'd call that a bug - Firefox lets its extensions intercept plugin-originated Web requests, and I don't see why Chrome couldn't, too. Is there anything about this on the Chromium bug tracker? – Pixievolt No. 1 Jan 23 '14 at 23:58