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}"/>"

eZ debug

Timing: Jan 29 2025 23:50:58
Script start
Timing: Jan 29 2025 23:50:58
Module start 'content'
Timing: Jan 29 2025 23:50:58
Module end 'content'
Timing: Jan 29 2025 23:50:58
Script end

Main resources:

Total runtime0.1373 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 588.0625180.8125
Module start 'content' 0.00650.0055 768.875097.9297
Module end 'content' 0.01210.1251 866.8047526.0000
Script end 0.1372  1,392.8047 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00372.6952200.0002
Check MTime0.00141.0146200.0001
Mysql Total
Database connection0.00060.460210.0006
Mysqli_queries0.094568.87101410.0007
Looping result0.00110.81711390.0000
Template Total0.124890.910.1248
Template load0.00070.534710.0007
Template processing0.124090.343810.1240
Override
Cache load0.00050.378110.0005
Sytem overhead
Fetch class attribute can translate value0.00110.784510.0011
XML
Image XML parsing0.00020.174210.0002
General
dbfile0.00463.3700200.0002
String conversion0.00000.005030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs