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

PHP如何設定HTTP安全標頭?

PHP如何設定HTTP安全標...

PHP該如何將以下安全標頭添加到網站? XFrameOptions  防止點擊劫持攻擊 XXSSPr...

使用PHP取得目前網址方式

使用PHP取得目前網址方式

pexelsphoto55 使用PHP取得網址相關的方式有下列幾種: $SERVER["R...

mysql 查詢數據資料是否有重複

mysql 查詢數據資料是否...

pexelsphoto5 有沒有試過資料庫裡上萬筆資料卻不知道是不是有重複的數據? 這時你一定要試試...

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