Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 09-04-2010, 09:46 PM preg replace problem
Skilled Talker

Posts: 83
Trades: 0
Hi, I am having a pretty difficult time getting files to upload to my server that have a Single Quote in the file name.
Example:

myfile's.pdf

I need to strip the file name of the quote before it uploads to the server.
I currently am using SWFUpload and this is the bit of code that was included with it.

I need to modify it to remove the single quotes as well. Been hammering my head over this all day.

PHP Code:
    $file_name preg_replace('/[^'.$valid_chars_regex.']|\.+$/i'""basename($_FILES[$upload_name]['name']));
    if (
strlen($file_name) == || strlen($file_name) > $MAX_FILENAME_LENGTH) {
        
HandleError("Invalid file name");
        exit(
0);
    } 
thanks

Last edited by Smudly; 09-04-2010 at 09:47 PM..
Smudly is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to preg replace problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20659 seconds with 12 queries