Click here to Skip to main content
15,031,495 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Dear All,

I am trying to develop a functionality that selects an image from local folder and then user can preview it before uploading.

I have achieved the functionality using html input tag and applying javaScript, the functionality works fine on localhost but when I try to deploy it to the SIT server, I get the following error,

Unable to get property of 0 or Undefined.

I am using input tag as follows,

HTML
<input type = "file" id="doc" onchange = "LoadImage(this);"/>


and in my JavaScript,

JavaScript
function LoadImage(input){
var files = input.files[0]; //getting error here only in SIT

}


The above functionality works absolutely fine in my LocalHost but having issues that are over my head in SIT. Someone please help.

What I have tried:

I have tried many things to take the input of an image but everything does not work on SIT
Posted
Updated 11-Jul-21 22:46pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900