I'm having problems trying to store the file extension into the DB
Hi all, I don't know what I'm doing wrong. I have a file upload field in my form. I just need it to upload the file and store the extension as well. Seems the file uploads though the extension is not being attached, thus, the file cannot be used or accessed. Weird. Any clue? Thanks.
UPDATE:
I found the issue. I was using a PHP code to remove commas from uploaded files. This is the code:
<?php
// Code added to strip comma from uploaded file name
if(isset($_FILES['image']['name'])) {
$_FILES['image']['name'] = str_replace(",","",$_FILES['image']['name']);
}
?>
<?php
if(isset($_FILES)) {
foreach($_FILES as $k => $v) {
$_FILES[$k]["name"] = strtolower(str_replace(array(" ","-","\\","'"), "", preg_replace('/.[^.]*$/', '', $_FILES[$k]["name"])));
}
}
?>
Not sure how can I keep removing commas now, thanks though.