rahul yadav
rahul yadav

Reputation: 31

not getting image file ,getting only name of file

i am uploading images /files on upload multiple image but it only shows image name not their mime type using java script

<input type='file' name='data[Expensedetail][description]["+i+"][expense_file][]' id='expense_file"+i+"' style='display: none' multiple='true'>

where 'i' is value of array coming in loop i = 0,1,2,3 ... everything works fine and i am getting this result on post [images details][1]

[1]: https://i.sstatic.net/ixaXr.png and using

$finfo = finfo_open(FILEINFO_MIME_TYPE);
 echo finfo_file($finfo, $file); //$file is the file name coming in above image in array
echo $file;

failed to open stream: No such file or directory

Upvotes: 1

Views: 79

Answers (1)

tjbp
tjbp

Reputation: 3517

Sounds to me like you're missing enctype="multipart/form-data" in your form element - without it the server will process the file input as a text field and just receive the filename.

Upvotes: 1

Related Questions