View Single Post
ישן 18-05-07, 11:27   # 9
The Crow
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
מיקום: קריית אונו
גיל: 36
הודעות: 181
שלח הודעה באמצעות MSN אל The Crow

The Crow לא מחובר  

אתה יכול להשתמש ב JS
תוסיף אירוע לטופס/כפתור onsubmit/onclick שיקרא לפונקציה אשר תבדוק את הסיומות של הקובץ.
קוד:
<script language="JavaScript">
    extArray = new Array(".jpg", ".png", ".bmp");
    function LimitAttach(form, file) {
    allowSubmit = false;
    if (!file) return;
    while (file.indexOf("\\") != -1)
    file = file.slice(file.indexOf("\\") + 1);
    ext = file.slice(file.indexOf(".")).toLowerCase();
    for (var i = 0; i < extArray.length; i++) {
    if (extArray[i] == ext) { allowSubmit = true; break; }
    }
    if (allowSubmit) return true;
    else
    alert("Please only upload files that end in types:  "
    + (extArray.join("  ")) + "\nPlease select a new "
    + "file to upload and submit again.");
    return false;
    }
    //  End -->
</script>
בהצלחה.
  Reply With Quote