close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DFP Upload with fine name containing single quote

Thread began 5/24/2012 8:48 pm by jonm145238 | Last modified 5/25/2012 12:00 pm by jonm145238 | 2812 views | 6 replies |

jonm145238

DFP Upload with fine name containing single quote

I am using the File Upload in DFP from SuperSuite on a site where users are able to upload files. I have noticed that sometimes a file containing a single quite is uploaded and the single quote in the filename is changed to \'

So for example, if I start with the file:

Test File'.txt

I end up with:

Test File\'.txt

I am sure most of my users are using Windows so the single quote is a valid character in the file name. The slash is much more of an issue as file names go.

The problem is that I can not tell where this conversion is taking place and I really need to just prevent users from uploading files with a single quote in the name in the first place. I also do not want to end up with the \' in the name. I am ok with just removing the character, I just need to figure out where and possibly what the best way to do this might be.

Sign in to reply to this post

Jason ByrnesWebAssist

add the following code at line 1 to strip the \' from the file name:


php:
<?php

if(isset($_FILES['fileField'])) {
    
$_FILES['fileField'] = str_replace(array("\\","'"),"",$_FILES['fileField']);
}
?>




where "fileField" is the name of your file field

Sign in to reply to this post

jonm145238

Thanks but this did not work.

I added the code to line one of one of the two pages that I am doing uploads from, changed fileField to upload and I still have exactly the same results.

It seems to me that I pass through this code when the page is loaded, not when the file is uploaded. So I am wondering if this is the correct place to add this code?

It would seem to me that this needs to be added somewhere within helperphp.php but where is the $1000 question because the code is not all that easy to follow. I know it is not the beginning of that file because it will have exactly the same effect as adding it to the beginning of my file.

Sign in to reply to this post

Jason ByrnesWebAssist

that code should do the trick, send a copy of your page please so i can investigate.

Sign in to reply to this post

jonm145238

The file is attached

Sign in to reply to this post

Jason ByrnesWebAssist

hmmmm, that page works to strip out the slash and single quote on my computer, maybe try changing the code to this:

php:
<?php

// Code added to strip single quote from any entered file name
if(isset($_FILES['upload']['name'])) { 
    
$_FILES['upload']['name'] = str_replace(array("\\","'"),"",$_FILES['upload']['name']); 

?>
Sign in to reply to this post

jonm145238

That was odd, yep now it works. Thanks!

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...