#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    12
    Rep Power
    0

    Upload file references?


    I'm working on a project in PHP which requires users to submit images for future processing. This is an intranet tool for files that also exist within our intranet.

    What I want is for users to "upload" files from our intranet, but I want to store in the database the path to the local file, rather than uploading the file itself.

    Can this be done w/ PHP? basically I just want the user to submit a bunch of paths/to/the/file.jpg (these are average users, not power users).

    Thanks!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,457
    Rep Power
    594
    Yes.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,056
    Rep Power
    9398
    You cannot get the original filename from a file upload so you'd have to prompt them for literally the location of the file. That could be a text box or, more user friendly, a browse page (if possible).

    For that browse page you'd do file and directory listings the exact same way you would do it for a local (ie, on the server) directory. Permissions can be a problem though, depending on your setup.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    12
    Rep Power
    0
    Originally Posted by gw1500se
    Yes.
    Haha whoops. What I meant was:

    "How can I accomplish this, preferably using just PHP and I guess using Javascript but only if necessary"
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,457
    Rep Power
    594
    Search engines are your friend.
    http://www.tizag.com/phpT/fileupload.php
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    12
    Rep Power
    0
    Originally Posted by gw1500se
    Search engines are your friend.
    You're aware that isn't my question, and that won't work, right? Or are you just clogging up the thread for funsies?
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,457
    Rep Power
    594
    No, you asked about uploading files in PHP. Perhaps your question was not clear.

    Comments on this post

    • manzell disagrees : needlessly being a jerk
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    12
    Rep Power
    0
    Originally Posted by gw1500se
    No, you asked about uploading files in PHP. Perhaps your question was not clear.
    It's obvious you didn't read the question then.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,457
    Rep Power
    594
    No, since you ignored requinix's solution, I thought you meant something else.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  18. #10
  19. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,056
    Rep Power
    9398
    Relax guys.

    Does my reply help? It does seem like you skipped over it but maybe you simply jumped to the latest reply?
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    12
    Rep Power
    0
    Originally Posted by requinix
    Relax guys.

    Does my reply help? It does seem like you skipped over it but maybe you simply jumped to the latest reply?
    I've had a devil of a time figuring out what a 'browse page' is in this context - it's nearly ungoogleable.

    A thought crossed my mind that because the files are already directly accessed by the server, perhaps there is a prebuilt tool to browse files on the host - in which case, the path could be available.
  22. #12
  23. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,056
    Rep Power
    9398
    Yeah, a page to let users browse... the directories and files they can look at. Kinda left that part off didn't I?
    There's no doubt some stuff already pre-built but it shouldn't take long to make a page that can do it. It's basically a matter of taking a directory name, validating it, and showing what's inside. Directories link back to the browse page itself (with the new directory) and files link to whatever your pseudo-upload thing is.

IMN logo majestic logo threadwatch logo seochat tools logo