Forums / Developer / Problem with input type = "file" not working

Problem with input type = "file" not working

Author Message

meriam santos

Sunday 21 February 2010 2:23:26 pm

Hi there,Have this problem and no idea why its not uploading the file. I have added a new attribute - file, to an existing class. added this code:Can somebody please help me?cheers...

meriam santos

Sunday 21 February 2010 2:24:35 pm

"<input type="file" name="attr_{$ContentObjectAttribute:item.contentclass_attribute_identifier} value="{$ContentObjectAttribute:item.content}" />"

André R.

Monday 22 February 2010 7:06:10 am

Looks like name is incorrect.

Take a look in the normal template for the datatype you added in design/standard/templates/content/datatype/edit/ezbinary.tpl

In trunk it has name like this:

name="{$attribute_base}_data_binaryfilename_{$attribute.id}"

And it does not use content as the value of the input.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

meriam santos

Monday 22 February 2010 5:50:13 pm

Hi Andre,

Thank you for your reply. I tried changing the code but still not uploading or changing if the file exist.to give you an idea here is the rest of the code:

the code used for the text area. this one displays the text and can be edited.

" {* Sequence number override *}
{if eq($ContentObjectAttribute:item.contentclass_attribute.name|wash, "Sequence Numbers")}
<input type="hidden" name="EditContentObject" value="true" /> <p class="box">
<textarea {if not($content_object.can_edit)}READONLY{/if}
name="attr_{$ContentObjectAttribute:item.contentclass_attribute_identifier}" cols="52"
rows="{$ContentObjectAttribute:item.contentclass_attribute.data_int1}">{$ContentObjectAttribute:item.content}</textarea></p> "

code i used for file type. this code displays the current file if any and a browse button for upload but its not making any changes to the file attribute.

"{elseif eq($ContentObjectAttribute:item.contentclass_attribute.name|wash, "Tracking sheet")}
{section show=$content_object.can_edit}
{attribute_edit_gui attribute_base=$attribute_base attribute=$ContentObjectAttribute:item}
{section-else}
{attribute_view_gui attribute_base=$attribute_base attribute=$ContentObjectAttribute:item}
{/section} "

can you please tell me what i'm missing? its simple for textarea.

Really appreciate any reply from you.

cheers

meriam santos

Monday 22 February 2010 6:18:23 pm

By the way the code is inside a form: the form edits the status of the record from one location to Archive. I dont know how to pass the changes to the file attribute.

"<form method="post" onsubmit="return confirmSubmit()" name='recoveryForm' action={"content/action"|ezurl}> <input type="hidden" name="EditContentObject" value="true" />
<input type="hidden" name='attr_status' value="0"/>
<input name="MoveButton" type="submit" value="Archive"/>
<input type="hidden" name='MoveToParentNode' value="{$archive_node}"/>"