javascript - Getting the file extension without knowing it's name -


i need know if there way retrieve real file extension without parse filename.

in code split file using function split(filename, ".") last element of array function returns.

now, if create .pdf file called, example test_file.pdf, previous method works perfectly, if rename file test_file(without extension) cannot retrieve extension if know file pdf.

for example, if rename test_file.pdf text_file.jpg how can recognize file still pdf , not image file .jpg extension?

i know if there way obtain information, maybe using file metadata or other information related file.

i'm looking javascript solution because have check extension when upload file using form (client side) java solution fine, can me?

thank in advance!

look @ post , marked answer: get real file extension -java code

i guess it's need.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -