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

使用 Closure Compiler 幫 javascript 瘦身

使用 Closure Com...

JavaScript(縮寫為JS)是一種進階的、直譯的程式語言,且作為客戶端手稿語言在使用者的瀏覽器...

要如何修改Plesk空間上傳檔案大小的限制

要如何修改Plesk空間上傳...

Plesk的預設狀況下上傳檔案限制為M。 若要修改上傳限制 首先點選開發工具的PHP設定 innim...

當XAMPP遇到VMWARE占用PORT 443導致無法啟動APACHE

當XAMPP遇到VMWARE...

在使用XAMPP時,若系統有安裝 VMWare Workstation,VMWare會將 port ...

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