Skip to content
Advertisement

I created a JS file for this source and called it, and it does not work

While it works well in PHP,

I have created a JS file and run it and it does not work.

No error message is displayed.

upload.js

JavaScript

index.php (There are not a few of PHP’s)

JavaScript

It works fine in php, but it does not work if you create a separate file called js.

Advertisement

Answer

You have some PHP code left in your .js, in uploadNext():

JavaScript

Because this is detached from your file this sizeMax variable won’t get set. So you need another way to get sizeMax accessible by javascript.

I suggest you do the following, in index.php, in the <head> (by the way you are missing </head>:

JavaScript

Then modify your js code sizeMax line

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement