Loading...

使用jquery判斷上傳檔案大小

Temperature: 0 °C

Mark ChangMark Chang
author_tools

首先得引用jquery

var fileSize = document.getElementById('filesid').files[0]; //獲得文件大小;
if(fileSize.size>5242880){
   alert('上傳檔案不能超過5MB');                
   return false;
}

上傳檔案若超過5MB,直接中斷。

以上紀錄。
 

https://innstory.com/story-使用jquery判斷上傳檔案大小-1881
javascript

Prev
 Android_Fragment及Activity_中使用sharedpreferences

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

About the Author

Mark Chang

離不開電腦的宅男

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

如何將 a href 禁用

如何將 a href 禁用

如標題,若採用CSS的方式作法如下: .disabled { pointerevents: none...

如何修復Undefined Index錯誤訊息

如何修復Undefined ...

錯誤的原因是因為當我們使用 $GET 和 $POST 方法取得變數時會發生這種情況,雖然PHP的部分...

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

設定Postfix使用SMT...

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

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