Can’t use forEach with Filelist

A FileList is not an Array, but it does conform to its contract (has length and numeric indices), so we can “borrow” Array methods: Array.prototype.forEach.call(field.photo.files, function(file) { … }); Since you’re obviously using ES6, you could also make it a proper Array, using the new Array.from method: Array.from(field.photo.files).forEach(file => { … });

PHP, get file name without file extension

No need for all that. Check out pathinfo(), it gives you all the components of your path. Example from the manual: $path_parts = pathinfo(‘/www/htdocs/index.html’); echo $path_parts[‘dirname’], “\n”; echo $path_parts[‘basename’], “\n”; echo $path_parts[‘extension’], “\n”; echo $path_parts[‘filename’], “\n”; // filename is only since PHP 5.2.0 Output of the code: /www/htdocs index.html html index And alternatively you can … Read more

Writing data into CSV file in C#

UPDATE Back in my naïve days, I suggested doing this manually (it was a simple solution to a simple question), however due to this becoming more and more popular, I’d recommend using the library CsvHelper that does all the safety checks, etc. CSV is way more complicated than what the question/answer suggests. Original Answer As … Read more