I'm trying to save uploaded files in my folder under same project directory or anywhere in machine. but i didn't got anything how to save using just javascript or jquery . HTML Code
<input type="file" id="myFile" />
JS code is here
$('#myFile').on('change', function () {
var filePath = $(this).val();
console.log(filePath);
});
Also, i'm not getting file uploaded path. Please help me soon. Thanks in advance.
to get file name this use code
var fullPath = document.getElementById('yourIdHere').value;
if (fullPath) {
var startIndex = (fullPath.indexOf('\\') >= 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/'));
var filename = fullPath.substring(startIndex);
if (filename.indexOf('\\') === 0 || filename.indexOf('/') === 0) {
filename = filename.substring(1);
}
alert(filename);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.