Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploadify strange GET request

I have an issue with the actual version of Uploadify (v3.1).

I read the docs, the source and browse Google and StackOverflow but I can't find where my problem is.

I have a basic form used to upload files on an internal server. I decided to use Uploadify and to manage all the Php with Symfony 2. It was not easy at first but everything works perfectly now.

But when I look at my console, I see that uploadify is making a GET request after init and after each of my uploads. The route called does not exist and I don't need any more action for this page.

Here is my code :

$('#file_upload').uploadify({
    debug: true,
    height: 30,
    swf: "{{ asset('Route_to_swf') }}",
    uploader: "{{ path('Route_to_upload') }}",
    width: 120
});

And here is my console error :

GET http://ip/project/web/app_dev.php/file/upload/ 404 (Not Found) 

The route /file/upload does not exist and I don't see it neither in my code or in the source. When I look at the demo on the uploadify website, I see the code looking exactly the same but there are no loose requests.

Does anyone have a clue ?

like image 887
SIkwan Avatar asked May 24 '12 09:05

SIkwan


1 Answers

Although this is over a year old ....

I was facing the same issue, and had 10 - 20 instances on a page (so you imagine 10 - 20 background requests).

The problem is that even if the button_image_url setting is not set, it will still make a request to the current page url

The solution from here seems to fix the problem.

Solution: find the following code in the upper part of the jquery.uploadify js 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 101
Radu Avatar answered Oct 16 '22 09:10

Radu