472,967 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,967 software developers and data experts.

Saving filenames on unix server with apostrophe in filename help needed

I have a PHP web app using MySQL - when I save a .jpg file named
test's.jpg I see that the filename on the unix server is: test\'s.jpg
- the filename I end up saving in my SQL table is named test's.jpg -
when I use an image tag to display the photo on my web page, no image
displays.

I tried to strip the slash out of the filename but the image still
won't display on the web page - maybe I'm all goofed up here and don't
understand what's going on with this slash char in the filename on the
server - can someone please help me to figure out how to get the image
to display on the web page?

Thanks...

Jul 17 '05 #1
3 6534
*** Ralph Freshour wrote/escribió (Wed, 12 Nov 2003 06:22:02 GMT):
I have a PHP web app using MySQL - when I save a .jpg file named
test's.jpg I see that the filename on the unix server is: test\'s.jpg
- the filename I end up saving in my SQL table is named test's.jpg -
when I use an image tag to display the photo on my web page, no image
displays.


You need to use urlencode() to convert "test's.jpg" into "test%27s.jpg".
Please note you must follow URLs rules; using backslash is just a typical
shell trick.
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #2
Ralph Freshour <ra***@primemail.com> writes:
I have a PHP web app using MySQL - when I save a .jpg file named
test's.jpg I see that the filename on the unix server is: test\'s.jpg
What software are you using to save the .jpg file? What software
are you using to display the filename? Depending on what you're
using, a file named test's.jpg might have the apostrophe escaped
as \' for display purposes, even though the backslash (\) isn't
really part of the name.

ls doesn't usually escape apostrophes, so if ls shows a backslash
then it's probably really part of the filename.
- the filename I end up saving in my SQL table is named test's.jpg -
when I use an image tag to display the photo on my web page, no image
displays.
What exactly does your IMG tag look like? Have you checked if the
problem is file permissions or file location instead of the file
name?
I tried to strip the slash out of the filename but the image still
won't display on the web page - maybe I'm all goofed up here and don't
understand what's going on with this slash char in the filename on the
server - can someone please help me to figure out how to get the image
to display on the web page?


It's usually wise to avoid filenames with characters that have
special meaning to shells or other software. Single-quotes
(apostrophes), double-quotes, spaces, semicolons, and a few other
characters are all special to most Unix shells and may require
escaping with a backslash (\) character, depending on what you're
doing. Nevertheless, such characters can be used in filenames, and
you should be able to use those filenames in IMG tags, although you
might need to do URL encoding of certain characters; in PHP, for
example, you can do this with urlencode(). Here are the encodings
for a couple of filenames:

test's => test%27s
test\'s => test%5C%27s

Hope this helps.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #3

"Michael Fuhr" <mf***@fuhr.org> wrote in message
news:3f********@omega.dimensional.com...
Ralph Freshour <ra***@primemail.com> writes:
[...], although you
might need to do URL encoding of certain characters; in PHP, for
example, you can do this with urlencode(). Here are the encodings
for a couple of filenames:

test's => test%27s
test\'s => test%5C%27s

Hope this helps.


Ralph might also want to try rawurlencode(). I've found that urlencode()
turns spaces into pluses "+", whereas the raw version does the job correctly
(<space> -> %20). Many *nix's *sh'es accept these characters in command line
so you will only need the commands to generate html tags.

B.
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Vikram | last post by:
Hi, Given below is my task. An user can open the xls file from my website (loaded on the top frame). After filling the Excel, he can click a send button at the bottom frame. By clicking the...
8
by: Tim | last post by:
Does anyone know a way to read the filenames from a given directory in C in a Solaris environment? I did this, but it seems goofy: sprintf(t, "ls *.csv > filenames.txt"); system(t); fptr =...
2
by: rbutch | last post by:
guys, i need a little help with this. this is working (well sort of) i get the info, but it's not moving to a new line as it iterates thru the array and all of the fields are like ONE HUGE LONG...
2
by: rino100 | last post by:
can anyone tell me why this c++ code works encrypting simple filenames but instead if you try to encrypt a filename like "video - 833 12_ ..avi" it doesn't rename the file?????? #include...
9
by: craig.overton | last post by:
All, I am currently developing an FTP class in VB.NET. It's kid tested, mother approved when trying to access an FTP Server on a Windows box meaning I can connect, run commands, upload and...
1
by: Rose | last post by:
Hi all, I'm trying to create a clickable link, but the pesky apostrophe is preventing the link from getting displayed properly. I'm displaying the contents of a folder (with contains the...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
5
by: Sonnich | last post by:
Hi all I use the opendir and readdir to search for files... but they read in all files, so sometimes I get several hundreds. If there is a way to give a wildcard, it might be a lot faster....
0
by: chongming | last post by:
Hi, i want to display all the filenames on browser. However i found that if there are many filenames in that folder, result will be it will display a long list of filenames on that browser. My...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.