Web Analytics Made Easy -
StatCounter populate input type=file field with existing data - CodingForum

Announcement

Collapse
No announcement yet.

populate input type=file field with existing data

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Resolved 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; Aug 25, 2011, 10:26 AM.

  • #2
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

    Comment


    • #3
      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!

      Comment

      Working...
      X