Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-24-2011, 10:05 PM   PM User | #1
dnnhater
New Coder

 
Join Date: Jul 2011
Location: Sunshine State
Posts: 79
Thanks: 18
Thanked 0 Times in 0 Posts
dnnhater is an unknown quantity at this point
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..
dnnhater is offline   Reply With Quote
Old 08-24-2011, 10:33 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,752
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Old 08-25-2011, 02:26 PM   PM User | #3
dnnhater
New Coder

 
Join Date: Jul 2011
Location: Sunshine State
Posts: 79
Thanks: 18
Thanked 0 Times in 0 Posts
dnnhater is an unknown quantity at this point
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!
dnnhater is offline   Reply With Quote
Reply

Bookmarks

Tags
form, input type="file", upload file

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:59 AM.


Advertisement
Log in to turn off these ads.