View Full Version : Ending Slash
12-12-2010, 04:32 PM
This should be an easy one but not sure how to figure it out. I'm trying to test some uploading of photos locally and I'm trying to put the path to the following:
$uploaddir = 'C:\xampp\htdocs\xampp\site\upload\';
I need the trailing slash to go to the correct folder but the last trailing slash is causing me to have an error. How can I do this?
12-12-2010, 04:50 PM
Exactly what is the error? There is nothing in what you posted that would cause an error.
12-12-2010, 04:55 PM
Parse error: syntax error, unexpected T_STRING in line 35 which is the next line after that.
Even in Dreamweaver it's making everything red after it. I think it's basically trying to escape the apostrophe with that slash and say that the apostrophe isn't supposed to end the text
12-12-2010, 04:59 PM
Errors like that are usually caused by something close to the line that is reported. Post a few lines around that one. You may also use regular forward slashes in paths instead of the Windows only back slashes.
12-12-2010, 05:01 PM
Here is some additional code, anything about that is all comments:
// Configuration ---------------------------------------------------------------
// Change the below path to the folder where you would like files uploading.
// e.g. "/home/yourname/myuploads/"
// or "c:\php\uploads\"
// Note, this MUST have the trailing slash.
$uploaddir = "C:\xampp\htdocs\xampp\site\upload\";
// Whether or not to allow the upload of specific files
$allow_or_deny = true;
// If the above is true, then this states whether the array of files is a list of
// extensions to ALLOW, or DENY
$allow_or_deny_method = "deny"; // "allow" or "deny"
Sorry I had to switch it to quotes instead of an apostrophe so it showed up on here.
12-12-2010, 05:05 PM
It's probably doing just what you said, interpreting that backslash as escaping the single quote, use two backslashes there and the first one should escape the second one and change the interpretation. However djm0219's suggestion of using forward slashes may be better.
12-12-2010, 05:32 PM
It won't work if you use double quotes since the back slash is the escape character. It should work fine with single quotes though. But, as I said, just change to forward slashes and you should be fine.
12-12-2010, 10:53 PM
$uploaddir = "C:\\xampp\\htdocs\\xampp\\site\\upload\\";
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.