0

I got this to send data to MySQL, but I need to send an image to upload.php together. How can I send an image with data to .php process?

$(document).ready(function(){
    $('#regcategoryerror').hide();
    $('#regcategory').hide();
    $('#IncludeCategory').submit(function(){
        var categoryname=$('#categoryname').val();
        var categoryurl=$('#categoryurl').val();
        $.ajax({
            url:"upload.php",
            type:"post",
            data: "name="+categoryname+"&url="+categoryurl,
            success: function (result){
                if(result==1){
                    $('#regcategoryerror').hide();
                    $('#regcategory').show();
                }else{
                    $('#regcategory').hide();
                    $('#regcategoryerror').show();
                }
            }
        })
        return false;
    })
})

0 Answers0