Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: Ending Slash

  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Posts
    438
    Thanks
    9
    Thanked 7 Times in 7 Posts

    Ending Slash

    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?

  • #2
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,307
    Thanks
    4
    Thanked 205 Times in 202 Posts
    Exactly what is the error? There is nothing in what you posted that would cause an error.
    Dave .... HostMonster for all of your hosting needs

  • #3
    Regular Coder
    Join Date
    Oct 2009
    Posts
    438
    Thanks
    9
    Thanked 7 Times in 7 Posts
    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

  • #4
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,307
    Thanks
    4
    Thanked 205 Times in 202 Posts
    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.
    Dave .... HostMonster for all of your hosting needs

  • #5
    Regular Coder
    Join Date
    Oct 2009
    Posts
    438
    Thanks
    9
    Thanked 7 Times in 7 Posts
    Here is some additional code, anything about that is all comments:
    PHP Code:
    // 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.

  • #6
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,451
    Thanks
    17
    Thanked 275 Times in 275 Posts
    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.

  • #7
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,307
    Thanks
    4
    Thanked 205 Times in 202 Posts
    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.
    Dave .... HostMonster for all of your hosting needs

  • #8
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    PHP Code:
    $uploaddir "C:\\xampp\\htdocs\\xampp\\site\\upload\\"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •