Uploading files and showing them on view port

5 views
Skip to first unread message

KH

unread,
Dec 26, 2009, 2:23:42 AM12/26/09
to UIZE JavaScript Framework Group
Hello..
I am writing a small application where I can upload an image and show
it on a view port. I also have to enable a few controls once the image
is correctly uploaded.

If I use PHP to upload images, there has to be some way to trigger
javascript events. Not sure how to do it. I was wondering if there are
any Uize modules written for this purpose.

Any guidelines will be highly appreciated.

with regards
KH

KH

unread,
Dec 26, 2009, 12:27:55 PM12/26/09
to UIZE JavaScript Framework Group
I did a little bit more research and found out that there are other
open source products like SWFupload to do the file upload. Now the
question is about integrating it with Uize. SWFupload, for example
provides call back functions once the upload is completed.
In my code, I've defined a Uize anonymous module which has the methods
to enable control for manipulating the uploaded image.

How do I call the methods in the anonymous module from the SWFupload
callback function?

A more general question would be how do I call Uize methods from any
javascript if the uize methods are inside an anonymous module?

Hope my questions make sense..

Ben Ilegbodu

unread,
Dec 26, 2009, 6:48:53 PM12/26/09
to uize
In order to call a function w/in an anonymous module you'd have to attach one of the functions to the global scope (i.e. the window object).  So in the anonymous function you should be able to do somethign like:

Uize.module({
required:'Uize.Widget.Page',
builder:function() {
window.uploadHandler = function() {
// handle stuff here
};
}
});

Hopefully that works.  Alternately to using the SWFObject you described, you should be able to have an upload field w/in an iframe and then when the iframe page submits, the page it posts to could call your global function like, parent.uploadHandler(), on page load...

Ben
ben...@gmail.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BenMVP.com
http://www.benmvp.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Visit my Zazzle stores!

http://www.zazzle.com/benmvp*
http://www.zazzle.com/benesol*
http://www.zazzle.com/rep_yo_city*
http://www.zazzle.com/name_gear*
http://www.zazzle.com/sports_gear*
http://www.zazzle.com/christ_centered*
http://www.zazzle.com/humor_gear*



--
UIZE JavaScript Framework...

...OFFICIAL WEB SITE: http://www.uize.com
...COOL UIZE SWAG: http://www.zazzle.com/uize_merch?rf=238804607086393908

UIZE JavaScript Framework Google Group...

...WEB SITE: http://groups.google.com/group/uize?hl=en
...TO POST: email to ui...@googlegroups.com
...TO UNSUBSCRIBE: email to uize-uns...@googlegroups.com

Kamal Hussain

unread,
Dec 26, 2009, 9:11:49 PM12/26/09
to ui...@googlegroups.com
Ben,
Thanks for the quick reply. The solution you suggested - attaching function to the window - seems to be working. I need to do a little bit more testing.

regards
Kamal
Reply all
Reply to author
Forward
0 new messages