Remove/Update File Path from Upload Input Field

document.getElementById("Upload_File").onchange = function () { var fileInput = this; var fileName = fileInput.value.split(/(\\|\/)/g).pop(); document.getElementById("file-name").innerHTML = fileName; };
This takes the file path from the upload field, pops off just the file name apart from the path--then places it in a p tag.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.