0

on my html I have this tag for user browse a file from their computer, like this

   *<form action="SamePageUpload.php" method="post"
    enctype="multipart/form-data">
   <label for="file">Filename:</label>
   <input type="file" name="file" id="file"><br>
   <input type="submit" name="submit" value="FINISH" onClick="echoHello()">
   </form>*

by hit Submit button is clicked it will trigger 'echoHello()' js function, I want to pass the image to a php file SamePageUpload.php

*

<script>
        function echoHello()
                {
                     var url = "SamePageUpload.php";
                     var cv = ????;
                    $.post(url, {contentVar: cv}, function(data){      
                        $("#alertDiv").html(data).show();
                    });

                 }
    </script>*

but I don't know what ???? should asign to cv, I want to know what's the variable that represent the image file user choose? Please help, thank you

0 Answers0