AliRıza Adıyahşi
AliRıza Adıyahşi

Reputation: 15866

Asp.Net Mvc uploadify?

Script

<script>
    $(document).ready(function () {
        console.log('@Url.Content(Request.Url.Authority + "/Content/uploadify/uploadify.swf")');
        $(function () {
            $("#file").uploadify({
               'uploader': '@Url.Content(Request.Url.Authority + "/Content/uploadify/uploadify.swf")',
               'script': '@Url.Action("_UploadImage", "Authors", new { area = "Admin" })',
               'cancelImg': '@Url.Content(Request.Url.Authority + "/Content/uploadify/uploadify-cancel.png")',
               'auto': false,
               'multi': false
            });
        })
    });
</script>

Html

@using (Html.BeginForm("Upload", "Home", FormMethod.Post, new { enctype = "multipart/form-data", id = "form_image" }))
{
    <p>
        <input type="file" name="file" id="file" />
        <a href="javascript:$('#file').uploadifyUpload();">Resmi Yükle</a>
    </p>
}

consol log output that is the correct as my expected.

localhost:4574/Content/uploadify/uploadify.swf

Error message:

GET localhost:4574/Admin/uploadify.swf?preventswfcaching=1360522154772 404 (Not Found)

Note: script and html codes are in an area that is named "Admin".

I cant find what am I missing. Any advice?

Thanks...

Upvotes: 0

Views: 489

Answers (1)

Sudhanshu
Sudhanshu

Reputation: 120

BUG When there is no background image uploadify makes a wrong http request to the current page url, appending false at the end.

The solution for this bug lies in "jquery.uplodify.js". Just find this line

  • this.settings.upload_url = WFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url)

And rewrite it as-

  • this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url = this.settings.button_image_url ? SWFUpload.completeURL(this.settings.button_image_url) : this.settings.button_image_url

Upvotes: 1

Related Questions