close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

AJAX loading gif

Thread began 4/28/2009 7:10 am by CraigR | Last modified 4/30/2009 10:29 am by Danilo Celic | 5450 views | 1 replies |

CraigRBeta Tester

AJAX loading gif

I created a php script to allow upload of an image, together with resize and thumbnail creation.

This works fine, but the person I am doing it for would like a visual indicator that the upload is in progress.

Using the YUI tools, and looking at some other forums, I managed to piece together a working sample, but i am struggling a bit with the javascript.

The problems arise with the upload handler.

When using ff, i don't get any problems, but with ie i get a response popup with lots of text.

attached is the relevant js code. If anyone can give me a few pointers I would be very grateful

var $E = YAHOO.util.Event;
var $ = YAHOO.util.Dom.get;
var $D = YAHOO.util.Dom;
function init(){
var onUploadButtonClick = function(e){
//the second argument of setForm is crucial,
//which tells Connection Manager this is a file upload form
YAHOO.util.Connect.setForm('uploadImage', true);

var uploadHandler = {
upload: function(o) {
$D.setStyle('indicator', 'visibility', 'hidden');

alert(o.responseText);

}
};
$D.setStyle('indicator', 'visibility', 'visible');
YAHOO.util.Connect.asyncRequest('POST', 'uploadcode.php', uploadHandler);

document.uploadImage.upload.disabled = true;
document.uploadImage.upload.value = "Uploading...";
};
YAHOO.util.Event.on('upload', 'click', onUploadButtonClick);
}

YAHOO.util.Event.on(window, 'load', init);
</script>

Sign in to reply to this post

Danilo Celic

I'm not quite familiar with the YUI library.

A quick look at the code I see that you have an alert that displays o.responseText, isn't that the "popup with lots of text" that you're seeing?

Beyond that, you will need to post a link to your page as this small snippet does't give the full story of what is actually happening.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...