Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
kamranzafar  
#1 Posted : Monday, October 19, 2015 5:52:16 AM(UTC)
kamranzafar

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!
Andrew  
#2 Posted : Monday, October 19, 2015 10:49:24 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 870

Thanks: 2 times
Was thanked: 26 time(s) in 26 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>
thanks 1 user thanked Andrew for this useful post.
kamranzafar on 10/28/2015(UTC)
Users browsing this topic
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.