sbaden
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by sbaden
-
-
Thank you birbal. I was afraid of that. What is the difference between not being able to access local files via javascript and HTML's <input> tag being able to select files? There's no way to do the same with javascript without the browse button right?
-
I have a basic understanding of both HTML and Javascript but am having trouble figuring out how they work together. I wrote some code where I'm trying to check to see if a local file exists... Not sure this can be done. In the example code I want to use headshotPath (file path) to see if the file in the path exists. Not sure what code to use to perform the check...
<!DOCTYPE html><html lang="en"> <head> <title>Player HS Verification 3</title> </head> <body> <input type="file" name="myFile" id="file-input"> <output id="list-missing"></output> <script> document.getElementById('file-input').addEventListener('change', handleFileSelect, false); function handleFileSelect(evt) { //////////////////////// //////////////////////// var teamTri= "ARI"; var playerLastName= "Acho"; var playerFirstName = "Sam"; var fileExtention = ".tga"; var imageName = playerLastName + "_" + playerFirstName + fileExtention; var headshotPath = "file:///Volumes/GRAPHICS01/HEADSHOTS/HEADSHOTS_12/03_Production/NFL/NFL_Sized/" + teamTri + "/" + imageName; document.getElementById('list-missing').innerHTML ='<ul>' + imageName + '</ul>'; } </script> </body></html>
Check if File Exists
in JavaScript
Posted
That makes better sense. Thank you.