ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

EE2: SAEF Hardcoded file upload ?

January 28, 2010 4:48am

Subscribe [1]
  • #1 / Jan 28, 2010 4:48am

    Peter Sommerfeld

    86 posts

    May be this is more a “How to” question then a PB question. For a hardcoded SAEF with 20 items I cannot use the integrated file upload form because I don’t want the normal users to access the CP. What I need is a way to upload images to an upload folder and populate the custom field (field_id_53 in this case) accordingly. I can get the path to the image to upload with an input form of type file. May be I overlook the obvious, but I get no idea how to proceed ...

    <?php
    $fields = array(
        'field_id_32','field_id_38','field_id_39','field_id_40','field_id_42',
        'field_id_43','field_id_44','field_id_45','field_id_46','field_id_47',
        'field_id_48','field_id_49','field_id_50','field_id_51','field_id_52',
        'field_id_53','field_id_54','field_id_55','field_id_56','field_id_57'
    );
    for($i = 0; $i < sizeof($fields); ++$i){
       if(isset($_POST[$fields[$i]]))
           $$fields[$i] = $_POST[$fields[$i]];
       else $$fields[$i] = '';
    }
    ?>
    
    {exp:channel:entry_form channel="sires" return="sires" preview="sires/new"}
    {preview}
         {!-- preview fields --}
    {/preview}
         {!-- custom fields --}
    
          <input type="file" name="???" value="???" /> {!-- how to proceed here for field_id_53 ??? --}
    {/exp:channel:entry_form

    Any hint or help is appreciated!
    EE 2.0.1 Build 20100121

    Moved to HowTo by Moderator

  • #2 / Jan 28, 2010 9:58am

    Sue Crocker

    26054 posts

    This is definitely HowTo .. moving and changing the title to reflect 2.0x.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases