close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

I'm having problems trying to store the file extension into the DB

Thread began 5/08/2014 7:00 am by marovios@yahoo.com | Last modified 5/08/2014 8:40 am by Jason Byrnes | 781 views | 3 replies |

marovios@yahoo.com

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.

Sign in to reply to this post

Jason ByrnesWebAssist

looks like this portion of the code:

preg_replace('/.[^.]*$/', '', $_FILES[$k]["name"])


is removing the dot and the extension.

remove the preg_replace function.

Sign in to reply to this post

marovios@yahoo.com

Perfect! Thanks much Jason!

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...