TamperedWithPartContext jQuery fileupload

29 views
Skip to first unread message

Arve Voldsund

unread,
Oct 23, 2012, 4:10:10 PM10/23/12
to hobo...@googlegroups.com
Hi,

I have an upload that is working pretty fine, but the update method (which is copied from the sgagility example and is working in other controllers) complains like this:

Dryml::PartContext::TamperedWithPartContext (Dryml::PartContext::TamperedWithPartContext):

I've tried renaming because google returned an issue with long context names, but to no avail. I'm stuck on this one, and it would be fine to get the update method to complete the ajax response and do the redirect :)

Anyone had this before?

Bryan Larsen

unread,
Oct 23, 2012, 4:12:49 PM10/23/12
to hobo...@googlegroups.com
The most common reason for that error is that your browser has an old
version of the page in its cache. ctrl-refresh your browser and then
try the upload again. Luckily this is usually only a problem during
development.

Bryan
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/P3Ag_YF4IpUJ.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.

Arve Voldsund

unread,
Oct 23, 2012, 4:25:50 PM10/23/12
to hobo...@googlegroups.com
Thanks for the suggestion. Did that, cleared history and restarted passenger but it's still the same. The upload works for single and multiple files, but the update method is stuck. More info:

Arve

Started PUT "/projectfiles/1-freskt?render[0][id]=image&render[0][part_context]=undefined" for 127.0.0.1 at 2012-10-23 22:22:36 +0200
Processing by ProjectfilesController#update as JS
  Parameters: {"page_path"=>"/projectfiles/1-freskt/edit", "authenticity_token"=>"rHt9RofH02OH8bvdj9ZW7lZXC74FLr3Ymt417MzXcCo=", "projectfile"=>{"prattach"=>#<ActionDispatch::Http::UploadedFile:0x007f9f57672ea8 @original_filename="Screen Shot 2012-09-14 at 1.31.54 AM.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"projectfile[prattach]\"; filename=\"Screen Shot 2012-09-14 at 1.31.54 AM.png\"\r\nContent-Type: image/png\r\n", @tempfile=#<File:/var/folders/ww/z22b7qzd0cd7w55798byhhzm0000gn/T/RackMultipart20121023-23827-1niwkep>>}, "render"=>{"0"=>{"id"=>"image", "part_context"=>"undefined"}}, "id"=>"1-freskt"}
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", "1"]]
  Projectfile Load (0.1ms)  SELECT "projectfiles".* FROM "projectfiles" WHERE "projectfiles"."id" = ? LIMIT 1  [["id", "1-freskt"]]
Command :: identify -format %wx%h :file
Command :: convert :source -auto-orient -resize "200x" -crop "200x138+0+2338" +repage :dest
Command :: identify -format %wx%h :file
Command :: convert :source -auto-orient -resize "100x100>" :dest
   (0.1ms)  begin transaction
   (0.3ms)  UPDATE "projectfiles" SET "prattach_updated_at" = '2012-10-23 20:22:37.011738', "updated_at" = '2012-10-23 20:22:37.151938' WHERE "projectfiles"."id" = 1
[paperclip] Saving attachments.
[paperclip] deleting lib/prattach/original/Screen_Shot_2012-09-14_at_1.31.54_AM.png
[paperclip] deleting lib/prattach/medium/Screen_Shot_2012-09-14_at_1.31.54_AM.png
[paperclip] deleting lib/prattach/thumb/Screen_Shot_2012-09-14_at_1.31.54_AM.png
   (4.2ms)  commit transaction
Completed 500 Internal Server Error in 164ms

Dryml::PartContext::TamperedWithPartContext (Dryml::PartContext::TamperedWithPartContext):
  app/controllers/projectfiles_controller.rb:28:in `block (3 levels) in update'
  app/controllers/projectfiles_controller.rb:27:in `block in update'
  app/controllers/projectfiles_controller.rb:26:in `update'


  Rendered /Users/arvevoldsund/.rvm/gems/ruby-1.9.3-p0@rails317/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.4ms)
  Rendered /Users/arvevoldsund/.rvm/gems/ruby-1.9.3-p0@rails317/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.2ms)
  Rendered /Users/arvevoldsund/.rvm/gems/ruby-1.9.3-p0@rails317/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (9.3ms)

Bryan Larsen

unread,
Oct 23, 2012, 4:32:51 PM10/23/12
to hobo...@googlegroups.com
> "/projectfiles/1-freskt?render[0][id]=image&render[0][part_context]=undefined"

'undefined' is probably not a valid part context. :)

Can you post your DRYML snippet with the part & form?

Bryan

Arve Voldsund

unread,
Oct 23, 2012, 4:42:46 PM10/23/12
to hobo...@googlegroups.com
Ooops... I must have gone blind on this one.. And still is.

This is the edit-page where the upload is located:

<edit-page content-size="9">
<body: class="container-fluid"/>
  <aside:>
    <!--The photo form has to be outside of the main form-->
    <attached-prattach-form/>
    <div part="status-box" id="status-box">
      <span id="edit-status" class="alert alert-success pull-right">
    
      </span>
    </div>
  </aside:>
    
  <delete-button: replace/>
   <prepend-content-header:>
    
  </prepend-content-header:>
  
  <form: update="status-box" no-spinner="true">
    <field-list: replace>
      <div class="container row columns tab-pane" id="resumen">
      <div class="span9">
          <field-list: fields="name"/>
        </div>      
        <div class="span9">
          <attached-prattach part="prattach"/>
        </div>
      </div>
    </field-list:>
  </form:>
</edit-page>



<def tag="attached-prattach-form">
  <form action="" class="pull-left" id="image-fileupload">
    <span class="btn btn-mini fileinput-button" 
      style="display:none;">
      <input type="file" id="fileupload-input" 
        name="projectfile[prattach]" multiple="true"
        data-url="&projectfile_path(@projectfile)"/>
    </span>
  </form>
  <div class="progress progress-striped active hide" id="upload-progress">
    <div class="bar" style="width:0%"></div>
  </div>
</def>

<def tag="attached-prattach">
<if test="&this.prattach?">
    <a href="&this.prattach.url(:original)" class="span12">
      <img src="&this.prattach.url(:medium)"/>
    </a>
</if>
<else><image src="missing_medium.png"/></else>
    <a class="btn btn-success" style="margin:5px" href="#" 
      onclick="$('input[type=file]').trigger('click');">
      <i class="icon-plus icon-white"></i>
    </a>
</def>

Arve Voldsund

unread,
Oct 23, 2012, 4:50:39 PM10/23/12
to hobo...@googlegroups.com
Found it. I changed the part from image to prattach and the erb wants image....

<div class="span9">
          <attached-prattach part="prattach"/>
        </div>

Sorry to bother you, and thanks for your help.

Arve
Reply all
Reply to author
Forward
0 new messages