I try to make upload page without refresh, when I select the file and press the button it does not come back with the file information if I use value, it gives me c:/fakepath/filename or undefined. I just want to upload file without using FormData.
Here is the code
<!doctype html>
<html lang="en">
<head><script src="http://localhost/jquery-1.10.2.js"></script></head>
<body>
<form enctype="multipart/form-data">
<input type="file" name="up[]" multiple>
<input type="file" name="up[]">
<input type="file" name="upload">
</form>
<script>
$( "form" ).submit(function( event ) {
event.preventDefault();
});
function omg(){
var elements= $( "form>*" );
$formdata=new FormData();
for(i=0;i<elements.length;i++){
var element=elements[i];
var elementtype=element.type;
var elementname=element.name;
if(elementtype == "file"){
if(element.value !== ""){
var files=element.files;
alert(files.name);
$("div").append(element.value + "<BR>");
}
}
}
}
</script>
</body>
</html>