This is a migrated thread and some comments may be shown as answers.

[Solved] uploading image causes call to action in controller

0 Answers 18 Views
Editor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Arjan
Top achievements
Rank 1
Arjan asked on 26 May 2011, 12:35 PM
Hi,
In a view/conroller that handles the manipulation of "articles" I have an action that creates an "article" for an "issue".
I created the usual pair of actions:

public

 

 

ActionResult CreateForIssue(int issueId)
and

 

 

[HttpPost]

 

public ActionResult CreateForIssue(Article newsletterarticle, int

issueId)

 

in the view for both these actions I use a Telerik Editor. It works fine

My  problem is that when ever I upload an image from within the imagebrowser, the (post) action "CreateForIssue" is called by some jquery function by a call to url /Article/CreateForIssue?issueId=1&callback=jQuery151008629403848206035_1306408025255
From Fiddler I see it is a post and has a body "fileNames=flower.jpg"

What is the correct way to prevent this call to actual cause the creating the article (if the model is valid it does so by default). Should I test for the "callback" parameter or should I prevent this route and how?

Moreover, why is this call interacting with my controller anyway? should i be looking for more such situations?
Hope you can help,
Arjan

Tags
Editor
Asked by
Arjan
Top achievements
Rank 1
Share this question
or