Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resumable is not defined #24

Closed
fitnessmechanics opened this issue Jan 9, 2018 · 6 comments
Closed

Resumable is not defined #24

fitnessmechanics opened this issue Jan 9, 2018 · 6 comments

Comments

@fitnessmechanics
Copy link

fitnessmechanics commented Jan 9, 2018

I am trying to learn to work with Resumable.js, and I keep coming up with the following error:

ReferenceError: Resumable is not defined.

In addition, clicking the h1 browseButton tag does not give a response. I have not made any changes to the resumable.js file, and my html in the test file is as follows:

<script src="resumable.js" type="application/javascript"></script>
<script>
var r = new Resumable({
  target: 'phptest.php',
});


r.assignBrowse(document.getElementById('browseButton'));
r.assignDrop(document.getElementById('browseButton'));

r.on('fileSuccess', function(file){
    console.debug('fileSuccess',file);
  });
r.on('fileProgress', function(file){
    console.debug('fileProgress', file);
  });
r.on('fileAdded', function(file, event){
    r.upload();
    console.debug('fileAdded', event);
  });
r.on('filesAdded', function(array){
    r.upload();
    console.debug('filesAdded', array);
  });
r.on('fileRetry', function(file){
    console.debug('fileRetry', file);
  });
r.on('fileError', function(file, message){
    console.debug('fileError', file, message);
  });
r.on('uploadStart', function(){
    console.debug('uploadStart');
  });
r.on('complete', function(){
    console.debug('complete');
  });
r.on('progress', function(){
    console.debug('progress');
  });
r.on('error', function(message, file){
    console.debug('error', message, file);
  });
r.on('pause', function(){
    console.debug('pause');
  });
r.on('cancel', function(){
    console.debug('cancel');
  });
</script>
<h1 id="browseButton">Select files</h1>
@dilab
Copy link
Owner

dilab commented Jan 11, 2018

Is file resumable.js stored locally correctly ?

@fitnessmechanics
Copy link
Author

It's in the same folder as the file calling it, is there more to it that I'm missing?

@dilab
Copy link
Owner

dilab commented Jan 11, 2018

Put the JS script at the bottom of the page. Make it the last piece to run.

@fitnessmechanics
Copy link
Author

Tried this, didn't change the result.

@fitnessmechanics
Copy link
Author

fitnessmechanics commented Jan 19, 2018

I took a whack at this today in at least 3 different browsers all running the console inspector. Eventually found at line 378, written in my code editor like this:

(extension.indexOf('') !== -1 && fileType.substr(0, extension.indexOf('')) === extension.substr(0, extension.indexOf('*')))  ||

turned into this:

(extension.indexOf('') !== -1 && fileType.substr(0, extension.indexOf('')) === extension.substr(0, extension.indexOf('*')))  ||

Notice the extra accented A near the end?
I found that removing the spaces on either side of where the A appears seemed to prevent the A from appearing and solve the error, although I have yet to fully test the API, I am hopeful that the issue has been resolved.

Also, I realize now that this is a forum for the server side PHP code, I apologize that it is in the wrong place.

@dilab
Copy link
Owner

dilab commented Jan 22, 2018

No worries.

Close it as it is an editor formatting issue.

@dilab dilab closed this as completed Jan 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants