Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

File names with & character

Posted on 2016-08-09
6
Medium Priority
?
141 Views
Last Modified: 2016-08-16
I am creating pdf files on a web server; the file name is based on a company name; some companies have the & character in the name, for example, SMITH&JONES.

Will this create an issue by attaching a pdf file with the name like SMITH&JONES.pdf to an email to send to someone? Emails created using phpMailer with attachment on web server.

Can abobe acrobat reader or other 3rd party pdf readers accept file names containing an &?

Thanks
0
Comment
Question by:Richard Korts
6 Comments
 
LVL 31

Accepted Solution

by:
Frosty555 earned 1000 total points
ID: 41749079
Assuming everybody escapes the "&" character properly, yes it should work fine.

The ampersand character is not a reserved character for most filesystems, meaning you can put it into filenames in Windows without any trouble and Adobe Reader and other programs will open it no problem.

It IS, however, a special character in URLs, because it denotes the end of one HTTP GET parameter and the start of the next parameter in a URL, e.g. "http://mywebsite.com/somepage.php?param1=foo¶m2=bar".

So if any website (including your own webserver) ever references the file name in the URL, it would need to make sure it is escaped properly, e.g. "http://mywebsite.com/somepage.php?file=SMITH&JONES".

You might also need to properly escape the character if you execute a bash script that references the filename, e.g. "mv /var/lib/foo/SMITH\&JONES.pdf  /foo/bar"

So assuming that the various technologies that you use escape and sanitize user input properly, you should have no problems.
0
 

Author Comment

by:Richard Korts
ID: 41749106
Frosty555,

I am aware of the "Get" consideration; that's what made me think this could be an issue to begin with. Use of & in urls is as you said.

So I think the only remaining question is if I build an email and attach a file named SMITH&JONES.pdf, will that go OK as far as email is concerned?

Thanks,

Richard
0
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 1000 total points
ID: 41749147
Here's my take on it, purely philosophical based on experience and without any instant testing to back it up.

File names are for the computers; they should never matter to the humans at all.  In fact, it is usually best to have a separate "display name" for the humans that is aligned with the true file name through some kind of translation table.

If you do it this way, you can display SMITH&JONES and keep the true (computer) file name out of the (human) display.  This means that you can use only known good values for the file names, avoiding the use of special characters, blanks, URL-sensitive characters, etc.

TL;DR: Use only A-Z, 0-9, and underscore in file names.  You will never have a problem with those characters.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Richard Korts
ID: 41749245
Ray,

That's what I kind of thought.

Just hoping to avoid some programming mods.

Thanks
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 41749400
No, just fix it.  Get the '&' out of the file names and URLs.  Even & in a URL gets interpreted as '&'.
0
 

Author Comment

by:Richard Korts
ID: 41749444
Yes, Dave.

I'm going to do that.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question