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

.htaccess設定網站預設首頁次序

.htaccess設定網站預...

一般php空間預設設定是index.php為首頁。 所以如果網站用index.php做首頁,就不需要...

javascript如何通過其 ID 設置選擇元素的選定選項?

javascript如何通過...

如題,透過javascript來針對某個select的option來做選定。 document.ge...

Linux底下查看Mysql版本

Linux底下查看Mysql...

在OS底下 [root@localhost ~]# mysql V 在Mysql底下 mysql> ...

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