Loading...

javascript如何取得檔案的副檔名?

Temperature: 0 °C

Mark ChangMark Chang
author_tools

var filename_a = "aaa.jpg";
alert(getFileExtension(filename_a)); //returs jpg

function getFileExtension(filename) {
/**/
}

使用String 的 split 方法
function getFileExtension(filename) {
return filename.split('.').pop();
}

以上紀錄。

 

https://innstory.com/story-javascript如何取得檔案的副檔名-1882
javascript

Prev
 使用jquery判斷上傳檔案大小

Next
使用curl執行POST請求 

About the Author

Mark Chang

離不開電腦的宅男

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

設定Postfix使用SMTP Server當作relay主機

設定Postfix使用SMT...

在/etc/postfix/main.cf 裡修改relayhost 將#relayhost = [...

Format JavaScript Date to yyyy-mm-dd

Format JavaScr...

timecalendar5 JavaScript將Sun May ,轉換成yyyymmdd func...

js判斷字母是否為大小寫

js判斷字母是否為大小寫

使用JS來判斷字串裡是否含有大寫字母或小寫字母。 //判斷是否含有大寫字母 function chk...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format