Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
i have one form and i have to choose one file in any type for upload on server plz help me

i have browse button and choose type .jpg
i wont to upload on server so what can i do
in (
javascript, java )
Posted
Comments
ridoy 22-Aug-13 10:52am    
unclear.
Shubhashish_Mandal 22-Aug-13 10:59am    
first.. do some google...

1 solution

C#
function checkFile(obj) {

        var fileElement = document.getElementById(obj);
        var fileExtension = "";
        if (fileElement.value.lastIndexOf(".") > 0) {
            fileExtension = fileElement.value.substring(fileElement.value.lastIndexOf(".") + 1, fileElement.value.length);
        }
        if (fileExtension == "gif" || fileExtension == "GIF" || fileExtension == "JPEG" || fileExtension == "jpeg" || fileExtension == "jpg" || fileExtension == "JPG" || fileExtension == "PNG" || fileExtension == "png") {
            return true;
        }
        else {
            alert("You must select a GIF,JPEG,JPG and PNG file for upload");
            document.getElementById(obj).value = '';
            fileElement.focus();
            return false;
        }
    }




try this it is some what useful for u?
Before Posting Question provide some clear picture about your faced problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900