Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Thread Tools Display Modes
Old 10-22-2011, 08:20 PM   #1
Join Date: Jan 2009
Posts: 115
Default Can servers add escaping to a file name ?

Hi - I am trying to get my site working on a remote server. I've had various issues where things work perfectly on an Apache server but not on the host server. I've learned a lot but the latest issue is confusing. My site allows a photo upload and subsequently the file name is changed. Now, if the file name has an apostrophe, normally on localhost it just gets processed and the file name is changed (so the code works). On my server you get the warning can't do this because the file or folder doesn't exist (I had that in development but got over it). I notice however, that on the warning, the apostrophe on the file name is escaped. The worrying thing is I can't exactly remember how my code dealt with this. Here are all the snippets that relate to the file name:

PHP Code:
@$fileName strip_tags(trim($_FILES['writer_photo_file']['name']));
$tmpName  strip_tags(trim($_FILES['writer_photo_file']['tmp_name']));
$fileSize strip_tags(trim($_FILES['writer_photo_file']['size']));
$fileType strip_tags(trim($_FILES['writer_photo_file']['type']));
$upload_destin '../../Local Root/innersongs/writer_photo_final'."//".$fileName
$fileName stripslashes($_FILES['writer_photo_file']['name']);
$filePath $upload_destin
$result move_uploaded_file($tmpName$filePath); 
On localhost, the above doesn't throw up an escaping problem.
Is the server putting in 'escaping' ?
If servers do this, how do you stop it.
I also have the same problem on my text area - even though I have a preg_match to indicate that an apostrophe is ok.
I'm not sure what might be going on here.
(Actually, on checking what I've written here, I notice that the add a photo script does not have the mysqli_real_escape_string added - is this it ?)
Thanks -
songboy is offline   Reply With Quote
Old 10-27-2011, 01:56 PM   #2
davidj's Avatar
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256

Are you using addslashes?
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 11-06-2011, 08:59 PM   #3
Join Date: Jan 2009
Posts: 115
Default it's magic quotes

Basically, the host server has magic_quotes_gpc turned on. They gave me my own php.ini file and I turned them off. That particular problem has been sorted.
All the best -
songboy is offline   Reply With Quote

Thread Tools
Display Modes

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

Forum Jump

All times are GMT. The time now is 07:32 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com