Welcome Guest Search | Active Topics | Sign In | Register

Triggering file upload with AJAXUploader control without using "Upload" button Options
Epitome
Posted: Friday, February 29, 2008 1:11:43 PM
Rank: Newbie
Groups: Member

Joined: 2/29/2008
Posts: 3
Hi All,

I'm working with a ASP.NET project with VB codebehind. I need to have the upload control with its integrated status bar (excellent work by the way--I think it's great) perform an upload via a code call instead of using the upload button. We are using a tabbed view control with a save button that does many other actions in addition to a file upload.

If we can get that to work, your control will be just what the Doctor ordered for the project.

Thanks

Mark Clark
Epitome Systems, Inc.
eo_support
Posted: Friday, February 29, 2008 1:21:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,096
Hi Mark,

Our uploader has a client side "upload" method that you can call to start the upload. For example, you can do something like this:

Code: HTML/ASPX
<a href="javascript: void AJAXUploader1.upload();">Start upload! </a>


That would have the same effect as pushing the upload button. Mostly you would also want to customize the uploader's LayoutTemplate to remove the default upload button since you do not want the upload to be triggered there.

This method was added very recently, so make sure you get the latest version.

Please feel free to let us know if you have any more questions!

Thanks


Epitome
Posted: Sunday, March 2, 2008 8:59:25 PM
Rank: Newbie
Groups: Member

Joined: 2/29/2008
Posts: 3
I tried your suggestion and I'm getting a javascript exception. It appears to be related to the ID mangling that occurs when ASPX pages are rendered into html for the browser. I tried the usual getObjectById method but the object returned still thows an exception we attempt to call the upload method.

I downloaded and installed your web tools on Thurday so I should have the latest assembly with the upload method.

Any suggestions?

Thanks
eo_support
Posted: Monday, March 3, 2008 5:26:17 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,096
Hi,

Try use eo_GetObject. For example:

eo_GetObject("AJAXUploader1").upload();

Thanks
Epitome
Posted: Monday, March 3, 2008 10:45:02 AM
Rank: Newbie
Groups: Member

Joined: 2/29/2008
Posts: 3
Thanks, the eo_GetObject function gets the fileuploader object successfully and the upload method uploads the files fine.

But, we then get some other issues.

1. The upload call returns immediately which we don't want--the other processing should wait until the file is uploaded. Is there a way to have the upload method not return until the file upload is complete?

2. The file uploaded event does not fire on the server side. While this is not strictly a problem, we do need to know (a) if the file is successfully uploaded and if so, (b) what is the file name.

Thanks!
eo_support
Posted: Monday, March 3, 2008 10:52:16 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,096
Hi,

There is no way to block a JavaScript function (otherwise your page will sit there appears to be freezing, which obviously is not what you want). What you can do is to monitor the upload progress by handling ClientSideOnProgress event.

The file uploaded event does not fire until the page is posted back (similar to a TextBox's TextChanged event, it does not fire immediately when you changed the text). You can set the uploader's AutoPostBack to true to let the uploader to automatically post back as soon as the upload is done.

Hope this helps.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.