I\'m currently trying to write an extension for Google Chrome, which can be used to upload files.
There are two pages: the background page and the popup page. The popup
Define it as a variable.
background.js
upload = function(fileName) {
console.log('Uploading', fileName);
}
popup.html
<script src="popup.js"></script>
popup.js
var BGPage = chrome.extension.getBackgroundPage();
BGPage.upload(the_filename);
That should work. If it doesn't, then check your inspector for the popup and background page:
It will open the inspector, then click on console to see the error messages in the console to assist you further, doing what I stated above should work, I do it all the time.