Created
August 17, 2021 10:44
-
-
Save rafiahmedd/c6ca65b8b582f07af429e02be38fef14 to your computer and use it in GitHub Desktop.
Add a preview system in FF file upload field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.ff_file_upload_holder').each(function(){ | |
$(this).change(function(){ | |
let uploadField = $(this).next().children(); | |
let fileLink = uploadField.attr('data-src'); | |
if(fileLink){ | |
uploadField.children('.ff-upload-thumb').click(function(){ | |
window.open(fileLink,'blank'); | |
}); | |
let fileName = uploadField.children('.ff-upload-details').find('.ff-upload-filename').html(); | |
uploadField.children('.ff-upload-details').find('.ff-upload-filename').html(`<a href = ${fileLink} target = "blank"> ${fileName} </a>`) | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment