Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File upload php, get only file name

Is it possible to get the filename of a file, without a complete upload

Meaning after the user chose a file, dont upload that file, just get the filename and save to database?

like image 452
Michael Lau Avatar asked Mar 02 '15 10:03

Michael Lau


1 Answers

yes it is possible you can use the code as given below

$filename=$_FILES['nameofyourfileinput']['name'];
echo $filename;

you can echo the $filename;

OR You can use jquery to get this value like

$('#inputid').change(function(){
 var value =$(this).val();
 alert(value);
})
like image 110
priya786 Avatar answered Oct 24 '22 10:10

priya786