views:

103

answers:

1

Hello all,

I really need advice on how to do the following. I have tried several things and they have not worked.

I would like to upload a video to viddler using their REST API.

I wish to upload a video directly to them. However, I want to upload to them without reloading the page?

How can I do this?

  • I have tried AJAX with an iFrame. However, JS does not allow you to access the response even though I have successfully uploaded file!

Thanks all

Update

Will Flash have work in this situation or will it fall to the same fate as JavaScript?

+3  A: 

Write a server-side proxy to make the HTTP request to Viddler and interpret the response from them. Then use AJAX to call your proxy in the iFrame. Since the proxy script will reside on your server/domain, you will be able to interpret the response with Javascript.

I already answered this.

Josh Stodola
I understand, but it will mean the file upload has to go through me which will take up bandwidth. In addition, users will have to wait twice as long because the file upload goes through me.
Abs
Are you saying there is NO OTHER WAY?
Abs
That's the breaks. You don't want to reload the page - it'll cost ya.
Josh Stodola
Yes, that's what I am saying. And I know because I've been down the very road you are currently traveling.
Josh Stodola
If it's too much for you, then you need to ask yourself if it is OK to assume that the video upload was successful, and, if so, forget about interpreting the response in the Iframe.
Josh Stodola
That I can not do because I need the response which contains the video_id!
Abs
If that's the case, then I will use intermediary script. :(
Abs
Then you'll need a proxy. End of story.
Josh Stodola
I know it's no fun making an extra trip just so that client script can access it, but that's just the way it works. Security measures have drawbacks, not just benefits.
Josh Stodola
Would Flash work in this occasion or will have the same problems?
Abs
I am not sure; I despise Flash.
Josh Stodola