Jump to content
  • 0

Condition to only accept JPEG FILES


KAPITYAN

Question

3 answers to this question

Recommended Posts

  • 0

Hi, that would be possible using Javascript. You may try this code if this will work for you:

<SCRIPT LANGUAGE="JavaScript"> 
var file = document.getElementById('InsertRecordfoto'); 

file.onchange = function(e){ 
var ext = this.value.match(/\.([^\.]+)$/)[1]; 
switch(ext) 

case 'jpeg': 
case 'jpg': 

break; 

default: 

alert('Invalid format! We only accept jpeg file. Please try to upload the correct extension.'); 

this.value=''; 

}; 

</SCRIPT>

You may change the field name which is "foto" based on the field that you are using in the table. You can paste that inside your Header and footer. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...