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 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2011
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Attachment Paths

    I have a browser form in which items can be checked off for receipt by email. They may be images, PDFs or other file types. When submitted to the cgi app on the server I seem to have it all working with one exception. I can't figure out how to specify the path for the selected files.

    I'm using $files = array("fileone.ext","filetwo.ext")

    My database is running via cgi.bin so the challenge (for me) is how to insert the path to the files which are in the sub-directories of the root. I know their locations, it's the format in my PHP array that eludes me.

    Would it be array("/images/fileone.ext","/docs/filetwo.ext") ?

  • #2
    Regular Coder
    Join Date
    May 2007
    Posts
    100
    Thanks
    16
    Thanked 11 Times in 11 Posts
    $_SERVER['DOCUMENT_ROOT'] contains the path on the server to the web root for your site.

    So if the files are web accessible then this would work as a path:

    $_SERVER['DOCUMENT_ROOT'].'/dir/file.pdf'

  • #3
    New Coder
    Join Date
    Aug 2011
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks, that's what I needed.


  •  

    Posting Permissions

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