Forums

[SOLVED]new fileupload field doesn't get updated in table

SAGO 08 Feb, 2012
Hi,

version: CFv3.2

I added an uploadfield to an existing form which was already connected to a table.
I followed the tutorial and checked some threads and did the save 'No' and then 'Yes' procedure but the field still didn't want to get updated.
So I added some more fields but this time textfields and did the same procedure.(adding the field in the table, disconnect and then reconnect) and try it again.
And to my surprise it updated the new TEXT-fields but still the upload-field wasn't updated.

So could it be possible that there is a small bug with adding a fileuploadfield after the form was created?
Or did I forget something.

PS: I did check the name of the tablefield which is 'picture2' and I set the ID and NAME attribute from the uploadfield also to 'picture2'.

    Form passed first SPAM check OK
    Form passed the submissions limit (if enabled) OK
    Form passed the Image verification (if enabled) OK
    Form passed the server side validation (if enabled) OK
    $_POST Array: Array ( [url] => http://www.aaaaaaaa.be/site/index.php?option=com_chronocontact&chronoformname=acv_fields_form [language] => [person_or_group] => Persoon [firstname] => John [lastname] => Doe [jobfunction] => Manager [name_group] => [company_name] => ChronoCorp [email] => me@gggggg.com [poster1] => 1 [video_or_poster] => Affiche kiezen [poster2] => 2 [reaction] => testsetsetse [test] => testeen [test2] => testtwee [button_1] => Verzenden [3a5599c59be6fb4baaaa023cb52ab83c] => 1 [1cf1] => 7efb351f8f2da2ba25cf9f79737ab9c9 [chronoformname] => acv_fields_form )
    $_FILES Array: Array ( [picture] => Array ( [name] => picture_example_001.jpg [type] => image/jpeg [tmp_name] => /tmp/php7j58hD [error] => 0 [size] => 5148 ) [picture2] => Array ( [name] => picture_another_example.jpg [type] => image/jpeg [tmp_name] => /tmp/phpeqtAuG [error] => 0 [size] => 5148 ) [video] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [group_picture] => Array ( [name] => Groepsfoto1.jpg [type] => image/jpeg [tmp_name] => /tmp/phpyrGuTM [error] => 0 [size] => 5148 ) )
    Upload routine started for file upload by : picture
    /home/aaa/public_html/site/images/stories/media/20120208183859_picture_example_001.jpg has been uploaded OK
    Upload routine started for file upload by : video
    Upload routine started for file upload by : group_picture
    /home/aaa/public_html/site/images/stories/media/20120208183859_Groepsfoto1.jpg has been uploaded OK
    Form passed the plugins step (if enabled) OK
    An email has been SENT successfully from (Site Admin)form@aaaaaaa.be to me@ggggggggg.com
    Debug End





Any suggestion is highly appreciated!

Thanks in advance.

Regards,

Gosa
SAGO 09 Feb, 2012
Ok.

I found out myself by creating a new form and testing it again.

Using the 'Wizard Edit': WORKS
First I did it by using the 'Wizard Edit' to add a new File Upload Field and I set the 'Maximum File Size in KB' and 'Allowed extensions' and added this field manually to the table and disconnected and reconnected the connection and it worked.

Using the manual method: DIDN'T WORK (but not because of a bug)
When I go to 'Form Code' -> 'Form HTML' and I copy for example an existing code like the one below:

<div class="form_item">
  <div class="form_element cf_fileupload">
    <label class="cf_label" style="width: 150px;">upload file</label>
    <input class="cf_fileinput cf_inputbox" title="" size="20" id="file_1" name="upload1" type="file" />


And I change the NAME attribute to upload2 and I make the field in the table and disconnect and reconnect. Then I try again to upload a file in the second field.
Well then it doesn't work.

Difference between the two methods
When trying to figure out what the difference was between the two methods, it hit me.
But when you add manual code through FORM HTML you need to go to 'File Uploads' and in 'Field names/allowed Extensions/sizes(KB)' you need to add some values for the new file upload field like this:
upload2:jpg|gif|png|jpeg{2048-}

And because nothing was automatically added like for example upload2:{-} you don't get any error.
So when you try the form again you will see that it uploads it.

So the difference is that when you add a field with the wizard then it automatically adds something in 'Field names/allowed Extensions/sizes(KB)' like this:
file_6:{-}

But without this code it doesn't get saved in the table.

So here is the summary:
When adding a Upload File Field manually through FORM HTML then you need to go to the tab FILE UPLOADS and add some parameters in 'Field names/allowed Extensions/sizes(KB)' like
upload2:jpg|gif|png|jpeg{2048-}

In the example above you'll need to change upload2 to the name of your field.


Good luck.

Regards,

SaGo
GreyHead 09 Feb, 2012
Hi SAGO,

I'm a bit surprised that it does it automatically when you add a File Upload in the Wizard, that doesn't seem to work for me.

Bob
SAGO 09 Feb, 2012
Hi Bob,

I know why. When you add a upload field and you don't change the name (so don't use the apply button) and just save the form than you are right. It doesn't add anything in the File Uploads tab.
But when you change for example just the label and click on apply and then save the form then it adds automatically something like this:
file_0:{-}


So when adding a upload field I think everyone will at least change the label so they won't have the problem.
But this is easily forgotten when doing it manually and copying a an existing field in the FORM HTML.

Cheers
GreyHead 09 Feb, 2012
Hi SAGO,

Thank you, I didn't know that.

Bob
This topic is locked and no more replies can be posted.