Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploadify swf requesting URL on page load

I am using Uploadify on a Asp.net site, the url for the page is /Resource/Create/id, but on page load uploadify appears to be making a request to the root url of that page /Resource/Create/

This is causing a server errors because no id is supplied and filling up my logs, does anyone know what it could be requesting and if it can be set to not request this url. Here is my JS:

var id = $('#fileUpload').attr('data-id');
$('#fileUpload').uploadify({
  'swf': '/Scripts/Libraries/uploadify/uploadify.swf',
  'uploader': '/Resource/Upload/' + id
})
like image 867
Declan Cook Avatar asked Sep 11 '12 11:09

Declan Cook


1 Answers

I have resolved this issue by following eugen's comment on this thread,

http://www.uploadify.com/forum/#/discussion/7329/uploadify-v3-bug-unecessary-request-when-there-is-no-button_image_url-set-/p1

Find following code in the upper part of the file:

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

and rewrite it to:

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

like image 94
Declan Cook Avatar answered Sep 18 '22 17:09

Declan Cook