We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How to get Mark Huot’s File Extension to work with SAEF/Stand Alone Entry Form

Development and Programming

APGWest's avatar
APGWest
295 posts
16 years ago
APGWest's avatar APGWest

Will do. Thanks. It’s just a shame that I’m 99% of the way there and having to look at alternative solutions.

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

Well of course try journalistone’s solution as well. It looks like he/she ended up removing the “value=”file”” part from this hidden field:

<input type=“hidden” value=“file” class=“file” name=“field_ft_21”/>
       
APGWest's avatar
APGWest
295 posts
16 years ago
APGWest's avatar APGWest

Ok, good, that’s what I got from it too but no matter what combo I try I still get the “Call to member” error thrown at me. Here’s my code. Anyone/everyone feel free to pick it apart!

<?php
    if (isset($_POST['field_id_33'])) {
        $field_id_33 = $_POST['field_id_33'];
    }
    else {
        $field_id_33 = '';
    }

    if (isset($_POST['field_id_34'])) {
        $field_id_34 = $_POST['field_id_34'];
    }
    else {
        $field_id_34 = '';
    }

    if (isset($_POST['field_id_35'])) {
        $field_id_35 = $_POST['field_id_35'];
    }
    else {
        $field_id_35 = '';
    }

    if (isset($_POST['field_id_32'])) {
        $field_id_32 = $_POST['field_id_32'];
    }
    else {
        $field_id_32 = '';
    }
?> 

{exp:weblog:entry_form weblog="my_weblog" return="thanks_template" preview="submit" status="Open" sticky_entry="no" allow_comments="yes"}

    <table width="550px">
        <tr>
            <td width="175px" valign="top">* Title:</td>
            <td width="275px" valign="top"><input type="text" name="title" value="{title}" id="title" size="50"  /><label for="title"></label></td>
        </tr>
    
        <tr><td> </td></tr>
    
        <tr>
            <td width="175px" valign="top">* Description:</td>
            <td width="275px" valign="top">
                <textarea name="field_id_32" id="field_id_32"></textarea>
                <input type='hidden' name='field_ft_32' value='none' />
            </td>
        </tr>
    
        <tr><td> </td></tr>
    
        <tr>
            <td width="175px" valign="top">* Main Image:</td>
            <td>                                
                <input name="field_id_33_img[]" id="file_browser" type="file" value="" />
                <input type="hidden" value="" class="file" name="field_id_33" />
                <input type="hidden" class="file" name="field_ft_33" />
            </td>
        </tr>
    
        <tr><td> </td></tr>
    
        <tr>
            <td width="175px" valign="top">Second Image:</td>
            <td>
                <input name="field_id_34_img[]" id="file_browser" type="file" value="" />
                <input type="hidden" value="" class="file" name="field_id_34" />
                <input type="hidden" class="file" name="field_ft_34" />
            </td>
        </tr>
    
        <tr><td> </td></tr>
    
        <tr>
            <td width="175px" valign="top">Third Image:</td>
            <td>
                <input name="field_id_35_img[]" id="file_browser" type="file" value="" />
                <input type="hidden" value="" class="file" name="field_id_35" />
                <input type="hidden" class="file" name="field_ft_35" />
            </td>
        </tr>
    </table>
    
    

<<input type="submit" value="Submit"></p>

{/exp:weblog:entry_form}
       
APGWest's avatar
APGWest
295 posts
16 years ago
APGWest's avatar APGWest

If anyone can take a look at my code and let me know where I’m screwing up I’d really appreciate it.

       
somepulp's avatar
somepulp
2 posts
16 years ago
somepulp's avatar somepulp

Are you trying to acheive multiple uploads for the same field? Why not try that instead of using three separate custom fields?

At least simplify down to a single field for now.

       
APGWest's avatar
APGWest
295 posts
16 years ago
APGWest's avatar APGWest

Unfortunately I need them to be separate because one picture is meant to be the “main” image (required) while the other two are meant to be support images and completely optional.

       
PhireGuys's avatar
PhireGuys
525 posts
16 years ago
PhireGuys's avatar PhireGuys

If you are getting this error:

MySQL ERROR: Error Number: 1054 Description: Unknown column ‘field_id_15_img’ in ‘field list’ Query: INSERT INTO `exp_weblog_data` (`entry_id`, `weblog_id`, `field_id_15_img`, `field_id_15`, `field_ft_15`, `field_id_15_img_0`, `site_id`) VALUES (‘20’, ‘7’, ‘Array’, ‘’, ‘file’, ‘liedcenter_2.jpg’, ‘1’)

Then the reason is because you didn’t edit the file, ext.saef_enctype.php, properly. You did the edit that mdesign mentioned but you didn’t change the weblog_id. So go back to line 96 or so and look for where the weblog_id is set. Change that to the weblog ID of the weblog the form is posting to.

if (isset($options['hidden_fields']['weblog_id']) && $options['hidden_fields']['weblog_id']=='3') //change the weblog_id here
    $options['enctype']='multi';

You shouldn’t see this error anymore.

       
oscaralexander's avatar
oscaralexander
11 posts
15 years ago
oscaralexander's avatar oscaralexander

Hi guys. I must’ve read over this topic about five times now but keep running into the strangest error. I have three file inputs, yet only the last image gets uploaded. Here’s my (stripped) HTML:

<label for="fieldId24-1">Picture 1</label>
<input class="file" id="fieldId24-1" name="field_id_24_img[]" type="file" />

<label for="fieldId24-2">Picture 2</label>
<input class="file" id="fieldId24-2" name="field_id_24_img[]" type="file" />

<label for="fieldId24-3">Picture 3</label>
<input class="file" id="fieldId24-3" name="field_id_24_img[]" type="file" />

<input name="field_id_24" type="hidden" value="" />
<input name="field_ft_24" type="hidden" value="file" />
<input name="MAX_FILE_SIZE" type="hidden" value="1024" />

I’ve set the file extension to allow multiple uploads and rewrite filenames, I made sure the enctype is set properly and basically followed all other instructions here, yet when I hit the Submit button, only one image gets uploaded. If I create new entry through the CP everything works fine (i.e. all images are uploaded).

Of course I could switch to three seperate fields, but this seems like a more elegant approach. Should I ever get it to work.

Please help!

       
Batdelfuego's avatar
Batdelfuego
45 posts
15 years ago
Batdelfuego's avatar Batdelfuego

Hey Oscar…

I’m not sure but I think the File Extension will only let you upload one image at the time to the server. Thats is why you only see the last image uploaded. I think you would be better of using Fieldframe and nGen File inside the SAEF for multiple uploads.

This might help you get started… http://brandon-kelly.com/fieldframe/docs/saef

       
Hoku's avatar
Hoku
26 posts
15 years ago
Hoku's avatar Hoku

Can somebody post a full example on how to make Mark Huot’s extension to work in the SAEF? I’ve tried EVERYTHING and nothing works. :(

I keep getting:

MySQL ERROR:

Error Number: 1054

Description: Unknown column 'field_id_2' in 'field list'

Query: INSERT INTO `exp_weblog_data` (`entry_id`, `weblog_id`, `field_id_2`, `field_ft_2`, `site_id`) VALUES ('38', '3', '', 'file', '1')

Maybe I’m getting the field_id wrong? It is the number next to the number next to the field label in the custom fields area in the CP, right? I dunno, I’m pretty lost. Please help. :(

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
15 years ago
Matt Weinberg's avatar Matt Weinberg
Maybe I’m getting the field_id wrong? It is the number next to the number next to the field label in the custom fields area in the CP, right? I dunno, I’m pretty lost. Please help. :(

You may be looking at the field order.

You can get the field_id by hovering over the link to the field in the custom field page. At the end of the link it’ll say “&P=edit_field&field_id=6”. That “6” (or whatever) is the field ID.

Also, you should consider looking at nGen File:

http://www.ngenworks.com/software/ee/ngen-file-field/

       
Hoku's avatar
Hoku
26 posts
15 years ago
Hoku's avatar Hoku

That helped! Thanks so much!

       
Jason Morehead's avatar
Jason Morehead
454 posts
15 years ago
Jason Morehead's avatar Jason Morehead

I’ve been attempting to get the File extension to work on an SAEF, and I’m very close. It works just fine on the “add” SAEF form, but I’ve run into difficulties with the “edit” SAEF form.

If you edit an entry that has an image associated with it, and submit the form without making any changes to the image, the original image is left alone and still displays.

However, if you check the “Remove” checkbox, then the image doesn’t appear in the entry anymore, but it’s not actually deleted from the server (I can still see it if I FTP into the image directory). Additionally, if I remove the image, but attempt to upload a new one in its place, the new image is completely ignored.

Now, I’ve gone through the code in the CP, as well as the various examples in this thread, but to no avail. Here’s the basic code that I’m using (I’ve cleaned it up a bit and removed some extraneous pieces):

{if artwork != ""}

    <input type="checkbox" name="field_id_4_remove[]" value="{artwork}" class="delete" id="remove_this_artwork" />

    <label for="remove_this_artwork">Remove This Artwork</label>
    
    <input type="hidden" name="field_id_4" value="{artwork}" />

    <input name="field_id_4_img[]" type="file" class="file" />

{if:else}

    <input type="hidden" name="field_id_4" value="" />

    <input name="field_id_4_img[]" type="file" class="file" />

{/if}

I’m basically checking to see whether an image exists or not. If it does, than I display the current image, as well as the “Remove” button and the upload field. If there’s no image, than it just displays the upload field.

FYI, I intend to implement some JavaScript to hide/show things based upon whether or not the “Remove” checkbox is checked, but I wanted to get the basic functionality working before I did that.

Any ideas or help would be greatly appreciated. Thanks in advance.

       
Jason Morehead's avatar
Jason Morehead
454 posts
15 years ago
Jason Morehead's avatar Jason Morehead

Sigh… I’ve been at this for several days now, and something just isn’t clicking. I’ve switched my code over to a version akin to what adlur posted earlier, but to no avail.

Any help or ideas would be greatly welcome: I’m at a bit of a standstill on this project until I can get something figured out.

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
15 years ago
Matt Weinberg's avatar Matt Weinberg

Jason,

Why don’t you consider using Fieldframe and nGen?

-Matt

       
First 3 4 5 6

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.