samedi 3 avril 2021

JavaScript Form uploading files

I am new to web development, I was going through someones code, in that there was a form which allowed to upload files.

onclick the form called a function send(this)

So in the js function was declared like this

function send(form){
 if(form[0]==null || form[0].files[0]==null){
  return -1;
 }
}

I dont understand what this form[0] and form[0].files[0] are? What does the [0] represent? Is this an array or what? if its an array it was not declared anywhere in the code, but still the code was working




Aucun commentaire:

Enregistrer un commentaire