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

    Join Date
    Jan 2013
    Posts
    87
    Rep Power
    2

    Select option for directories


    I am really, really sorry about this newb question but I have been searching and searching all morning and I can not seem to get the answer I am looking for.

    What I am trying to do is have a html select with options and from the those options execute a certain script that will upload a image to that specific directory.

    Ex.

    Let say that they pick option with a value of photoshop. How would I be able to execute an image upload to that specific value which would be a directory


    oh then second problem how would I add the directory names to option values dynamically sense I am not doing it from a database, which i know would be eaiser.

    ex.

    directory names would be photoshop, indesign, and flash.

    Code:
    <option value="directory name"></option>
    Last edited by natturefrk; February 19th, 2013 at 11:55 AM. Reason: fixing something
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    do you generally know how to do file uploads, and have you implemented it already? If yes, please show your code. If not, that's the thing you should start with.

    Apart from that, you said you don't use a database. Why? And what do you use instead?
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,054
    Rep Power
    9398
    Do you mean how do you let a user choose where to upload a file?

    - You can use glob or scandir to get a list of things in a directory
    - The PHP manual has something on file uploads
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    87
    Rep Power
    2
    This is getting to be to advanced for me. I think that I will just try to go back to using a database. I know how to do almost everything with a database. The answer to your question requinox is yes I am trying to let the admin pick which folder to upload the image to. I still think this system is just to complicated. Should I recode to go through a database like I was originally intending to. I really dont know what to do at this point.
  8. #5
  9. No Profile Picture
    I haz teh codez!
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2003
    Posts
    2,549
    Rep Power
    2337
    It's not hard. One way:

    php Code:
    <?php
    $dirs = array('photoshop', 'indesign', 'flash');
    ?>


    php Code:
    <select id="directory_chooser">
    <?php foreach($dirs as $dir): ?>
      <option value="<?= $dir ?>"><?= $dir ?></option>
    <?php endforeach; ?>
    </select>
    I ♥ ManiacDan & requinix

    This is a sig, and not necessarily a comment on the OP:
    Please don't be a help vampire!

IMN logo majestic logo threadwatch logo seochat tools logo