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
    Jul 2011
    Location
    Sunshine State
    Posts
    80
    Thanks
    18
    Thanked 0 Times in 0 Posts

    populate input type=file field with existing data

    so I have a form that be used to update existing carriers and one of the fields is to allow to upload an image associated with that carrier - is there a way to populate that input field with the existing file name? this is maybe only the 2nd time ever that I've needed a file upload thingy so I'm not even sure how to google for the answer on my own

    PHP Code:
    <?php
          $page
    ->contentSet('
              <form action="" method="post" enctype="multipart/form-data">
              <p>
              Carrier ID: '
    .$getCarrier['viewCarrierRow']['id'].'<br />
              <label for="name">Name<span class="required">*</span>: </label>
              <input type="text" name="name" id="name" size="30" value="'
    .$getCarrier['viewCarrierRow']['name'].'" />
              </p>
              <p>
              <label for="address1">Address 1<span class="required">*</span>: </label>
              <input type="text" name="address1" id="address1" size="30" value="'
    .$getCarrier['viewCarrierRow']['address1'].'" />
              </p>
              <p>
              <label for="address2">Address 2: </label>
              <input type="text" name="address2" id="address2" size="30" value="'
    .$getCarrier['viewCarrierRow']['address2'].'" />
              </p>
              <p>
              <label for="city">City<span class="required">*</span>: </label>
              <input type="text" name="city" id="city" size="30" value="'
    .$getCarrier['viewCarrierRow']['city'].'" />
              </p>
              <p>
              <label for="state">State<span class="required">*</span>: </label>
              <input type="text" name="state" id="state" size="5" value="'
    .$getCarrier['viewCarrierRow']['state'].'" />
              </p>
              <p>
              <label for="zip">Zip<span class="required">*</span>: </label>
              <input type="text" name="zip" id="zip" size="10" value="'
    .$getCarrier['viewCarrierRow']['zip'].'" />
              </p>
              <p>
              <label for="phone">Phone<span class="required">*</span>: </label>
              <input type="text" name="phone" id="phone" size="30" value="'
    .$getCarrier['viewCarrierRow']['phone'].'" />
              </p>
              <p>
              <label for="fax">Fax: </label>
              <input type="text" name="fax" id="fax" size="30" value="'
    .$getCarrier['viewCarrierRow']['fax'].'" />
              </p>
              <p>
              <label for="logo">Logo: </label>
              <input type="file" name="logo" id="logo" size="30" value="'
    .$getCarrier['viewCarrierRow']['logo'].'" />
              </p>
              <p>
              <input type="hidden" name="editCarrier" id="editCarrier" value="1" />
              <input type="submit" name="editCarrierSubmit" id="editCarrierSubmit" value="Update Carrier Info" />
              </p>
              </form>
              '
    );
    ?>
    Last edited by dnnhater; 08-25-2011 at 02:26 PM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Standards dictate that you may provide a filename as a default value. This would be a full path to the file on the client's system.
    Best I know, most (all?) browsers will completely ignore the value attribute of the input type file for security reasons. So to answer your question, no you cannot reliably set a default file.

  • #3
    New Coder
    Join Date
    Jul 2011
    Location
    Sunshine State
    Posts
    80
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Thumbs up

    what you say makes perfect sense - at least now I know why I couldn't find anything on how to do it lol

    thanks so much!


  •  

    Tags for this Thread

    Posting Permissions

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