Aurigma Forums
»
Upload Suite
»
Discussions – HTML5/Flash Uploader
»
Error in "beforeUpload" event: uploader.metadata(...) is undefined
Rank: Newbie
Groups: Member
Joined: 10/19/2015(UTC) Posts: 2
Thanks: 1 times
|
I am using Aurigma first time in Asp.Net, In the documentation Uploading Additional Data in HTML5/Flash Uploader ASP.NET, there is an example of sending data as follows: Code:[code=jscript][code=csharp]<script type="text/javascript" language="javascript">
function onBeforeUpload() {
var uploader = $au.imageUploaderFlash('Uploader1');
uploader.metadata().addCustomField('authorField', 'Author Name');
}
</script>
Code:[code=csharp]<form id="form1" runat="server">
<aur:ImageUploaderFlash ID="Uploader1" runat="server" OnAllFilesUploaded="AllFilesUploaded" >
<ClientEvents>
<aur:ClientEvent EventName="BeforeUpload" HandlerName="onBeforeUpload" />
</ClientEvents>
</aur:ImageUploaderFlash>
</form>
[/code][/code][/code] When I upload a picture, I see the following error in Console (F12-Mozilla FireFox Developer Edition) beforeUpload error: uploader.metadata(...) is undefined [htmluploader_trace] [WARNING] Error in "beforeUpload" event: uploader.metadata(...) is undefined I am following the procedures as described in example but I don't know what I am doing wrong. Any help would be appreciated. Thanks!
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration Joined: 8/2/2003(UTC) Posts: 876
Thanks: 2 times Was thanked: 27 time(s) in 27 post(s)
|
The problem is that in ASP.NET the ID you specify in the server control is not the same as the ID of the element containing the uploader on the client side. As a result, $au.imageUploaderFlash('Uploader1') does not find the uploader. To avoid this, you should use the ClientID property of the control: Code:var uploader = $au.imageUploaderFlash("<%= Uploader1.ClientID %>");
However when you need to access the current uploader instance from the event handler, you may just use this: Code:<script type="text/javascript" language="javascript">
function onBeforeUpload() {
var uploader = this;
uploader.metadata().addCustomField('authorField', 'Author Name');
}
</script>
|
1 user thanked Andrew for this useful post.
|
|
|
Aurigma Forums
»
Upload Suite
»
Discussions – HTML5/Flash Uploader
»
Error in "beforeUpload" event: uploader.metadata(...) is undefined
Forum Jump
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.