reading contents of file when file uploading in php -



reading contents of file when file uploading in php -

i using javascript upload files in php.the sample code shown here

<div id="upload"> <input type="button" onclick="uploadfile();" value="+"> <script> var count=0; function uploadfile() { count=count+1; var x = document.createelement("input"); var br = document.createelement("br"); var text = document.createelement("input"); var remove = document.createelement("input"); text.setattribute("type", "text"); text.setattribute("name", "description_"+count); text.setattribute("value", "file description"); // remove.setattribute("type", "button"); // remove.setattribute("value", "-"); // x.setattribute("name",""); x.setattribute("type", "file"); upload.appendchild(br); upload.appendchild(x); upload.appendchild(text); upload.appendchild(remove); } </script> </div>

but here how uploaded files contents(means descriptions) @ page?.here using below php code.

foreach ($_post $key => $value) { "<br/>"; echo $key, ' => ', $value, "<br/>"; }

any advice appreciated.

thanks.

first of all, loop should this:

foreach ($_post $key => $value) { echo "<br/>"; echo $key. ' => '. $value. "<br/>"; }

use dots . instead of commas ,. refer this concatenation.

and regarding code: you're doing treating $_post array/collection , iterating through values, retrieving key $key , value $value.

php

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -