Aurigma Forums
»
Upload Suite
»
Discussions – ActiveX/Java Uploader
»
How programmacally click on the UPLOAD ALL button on the ImageUploader control
Rank: Newbie
Groups: Member
Joined: 3/27/2009(UTC) Posts: 9
|
I have ImageUploader control, some textboxes for additional info, and SUBMIT button. User enters additionl info, selects some files for upload, and clicks on the SUBMIT button. On the server side I need to process the data. Since the user did not click on the UPLOAD ALL button on the UmageUploader control, no files are uploaded. How can I forse the ImageUploader control to upload images before submitting the additional info when the user clicks on the SUBMIT button?
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Hello Anatoli,
You can send information from your textboxes when you click UPLOAD ALL button. You need to use the following property: iu.addParam("AdditionalFormName", "your_form_name");
Or you can send selected pictures with information from textboxes when you click SUBMIT. In this case you should use AdditionalFormName property as previously, also you need configure your SUBMIT button: <input type="button" value="SUBMIT" onClick="getImageUploader("ImageUploader").Send; return false;">
If you have any questions feel free to let us know.
|
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 3/27/2009(UTC) Posts: 9
|
Hi Tamila,
I'm using an ActiveX control of UmageUploader (codeBase="ImageUploader5.cab" ), and the code
onClick="getImageUploader("ImageUploader").Send; return false;"
does not work I guess because the ActiveX control does not have the SEND method. The error message is as follows:
"Microsoft JScript runtime error: Object doesn't support this property or method"
Please advise.
Regards,
Anatoli
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Anatoli, Image Uploader ActiveX has method Send, I just forgot "()" in this line: Code:onClick="getImageUploader('ImageUploader').Send(); return false;"
Try to use it. |
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 3/27/2009(UTC) Posts: 9
|
Tamila,
thanks a lot!
It works now. But submit does not happen after image upload process (Page_Load event is not fired up). Is there any way to still proceed with submit action after images are uploaded?
Regards,
Anatoli
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Hi Anatoli,
Could you please post here the code of the page where you experience problem with Image Uploader.
|
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 3/27/2009(UTC) Posts: 9
|
Hi Tamila,
the code is as follows:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register assembly="Aurigma.ImageUploader" namespace="Aurigma.ImageUploader" tagprefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div style="height: 760px"> <cc1:ImageUploader UploadView="Thumbnails" ID="ImageUploader1" runat="server" Height="750px" Width="630px" OnFileUploaded="ImageUploader1_FileUploaded" ShowDebugWindow="True" DescriptionsReadOnly="True" ShowDescriptions="False" ButtonSendText="Upload Photo(s)" MaxFileCount="10" LicenseKey="71050-4CA8B-00000-01D7A-39767;72050-4CA8B-00000-0B11C-CF8C9" ShowButtons="false" ShowUploadListButtons="true" /> <br /> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <br /> <br /> <br /> <input type="submit" value="SUBMIT" onclick="getImageUploader('ImageUploader1').Send(); return false;" /> </form> </body> </html>
My problem is that clicking on the SUBMIT button uploads images but does not initiate the SUBMIT process and the Page_Load event is not fired up. Even if I manage to process the uploaded images and additional info supplied by the TEXTBOX1 in the "ImageUploader1_FileUploaded" event on the server, this event is not activated when user does not selects any images to upload and just enters additional info into the TEXTBOX1 and clicks on the SUBMIT button - since there is no images to upload the ImageUploader1_FileUploaded event is not fired up, and I cannot process the TEXTBOX1 data on the server.
Regards,
Anatoli
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Hello Anatoli, You need to use type="button" instead of "submit", also you need to use AdditionalFormName property of Image Uploader as follows: Code:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register assembly="Aurigma.ImageUploader" namespace="Aurigma.ImageUploader" tagprefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 760px">
<cc1:ImageUploader UploadView="Thumbnails" ID="ImageUploader1" runat="server" Height="750px" Width="630px" OnFileUploaded="ImageUploader1_FileUploaded" ShowDebugWindow="True" DescriptionsReadOnly="True" ShowDescriptions="False" ButtonSendText="Upload Photo(s)" MaxFileCount="10" LicenseKey="71050-4CA8B-00000-01D7A-39767;72050-4CA8B-00000-0B11C-CF8C9" ShowButtons="false" ShowUploadListButtons="true" AdditionalFormName="form1"/>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<br />
<input type="button" value="SUBMIT" onClick="getImageUploader('ImageUploader1').Send(); return false;" />
</form>
</body>
</html>
|
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 3/27/2009(UTC) Posts: 9
|
Hi Tamila,
thank you for getting back to me.
Unfortunately your code does not work in cases when the user just enters the data into the text box, but does not select any images to upload, and clicks on the SUBMIT button. Nothing happens, no event is fired, but I still need to process the submission - to save the info entered in the textbox into my database, even without any images uploaded.
Regards,
Anatoli
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Okay, In this case you can use the following code: Code:<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 760px">
<cc1:ImageUploader UploadView="Thumbnails" ID="ImageUploader1" runat="server" Height="750px" Width="630px" OnFileUploaded="ImageUploader1_FileUploaded" ShowDebugWindow="True" DescriptionsReadOnly="True" ShowDescriptions="False" ButtonSendText="Upload Photo(s)" MaxFileCount="10" LicenseKey="71050-4CA8B-00000-01D7A-39767;72050-4CA8B-00000-0B11C-CF8C9" ShowButtons="false" ShowUploadListButtons="true" AdditionalFormName="form1"/>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<br />
<script>
function UploadFiles()
{
if (getImageUploader("ImageUploader1").getUploadFileCount()>0)
{
getImageUploader('ImageUploader1').Send();
return false;
}
else
document.form1.submit();
}
</script>
<input type="button" value="SUBMIT" onClick="UploadFiles()" />
</form>
</body>
</html>
|
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 3/27/2009(UTC) Posts: 9
|
Hi Tamila,
thank you for helping me out. The last solution is almost there but in the FileUploaded event, after processing the image, I need to redirect to another page, and it is not allowed because of the way the imageUploader communicates to the IIS. It would work if the javascript could just wait till all images are uploaded, and then fire the SUBMIT process. So it would work for me if the javascript were as follows:
function UploadFiles() { if (getImageUploader("ImageUploader1").getUploadFileCount()>0) { getImageUploader('ImageUploader1').Send(); waitTillSendIsCompleted(); document.form1.submit(); return false; } else document.form1.submit(); }
Is there any way to implement the waitTillSendIsCompleted() function that just needs to wait till all the files are uploaded?
Regards,
Anatoli
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Anatoli, As waitTillSendIsCompleted() you can use AfterUpload event listener. As follows: Code:<cc1:ImageUploader UploadView="Thumbnails" ID="ImageUploader1" runat="server" Height="750px" Width="630px" OnFileUploaded="ImageUploader1_FileUploaded" ShowDebugWindow="True" DescriptionsReadOnly="True" ShowDescriptions="False" ButtonSendText="Upload Photo(s)" MaxFileCount="10" LicenseKey="71050-4CA8B-00000-01D7A-39767;72050-4CA8B-00000-0B11C-CF8C9" ShowButtons="false" ShowUploadListButtons="true" AdditionalFormName="form1" OnClientAfterUpload="ImageUploader1_AfterUpload"/>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<br />
<script>
function ImageUploader1_AfterUpload(Html) {
document.form1.submit();
}
function UploadFiles()
{
if (getImageUploader("ImageUploader1").getUploadFileCount()>0)
{
getImageUploader('ImageUploader1').Send();
return false;
}
else
document.form1.submit();
}
</script>
<input type="button" value="SUBMIT" onClick="UploadFiles()" />
Also I think you can remove OnFileUploaded event. |
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 3/27/2009(UTC) Posts: 9
|
Tamila,
thank you for the solution. Unfortunately your code does not work - the OnClientAfterUpload="ImageUploader1_AfterUpload" event is not fired up.
Please advise.
Regards,
Anatoli
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Hi, Try to write realization of ImageUploader1_AfterUpload event before Image Uploader description: Code:<script>
function ImageUploader1_AfterUpload(Html) {
document.form1.submit();
}
</script>
<cc1:ImageUploader UploadView="Thumbnails" ID="ImageUploader1" runat="server" Height="750px" Width="630px" OnFileUploaded="ImageUploader1_FileUploaded" ShowDebugWindow="True" DescriptionsReadOnly="True" ShowDescriptions="False" ButtonSendText="Upload Photo(s)" MaxFileCount="10" LicenseKey="71050-4CA8B-00000-01D7A-39767;72050-4CA8B-00000-0B11C-CF8C9" ShowButtons="false" ShowUploadListButtons="true" AdditionalFormName="form1" OnClientAfterUpload="ImageUploader1_AfterUpload"/>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<br />
<script>
function UploadFiles()
{
if (getImageUploader("ImageUploader1").getUploadFileCount()>0)
{
getImageUploader('ImageUploader1').Send();
return false;
}
else
document.form1.submit();
}
</script>
<input type="button" value="SUBMIT" onClick="UploadFiles()" />
|
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 3/27/2009(UTC) Posts: 9
|
Tamila,
unfortunately it does not help.
Regards,
Anatoli
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 3/27/2009(UTC) Posts: 9
|
Hi Tamila,
I've changed the OnClientAfterUpload="ImageUploader1_AfterUpload" to AfterUpload="ImageUploader1_AfterUpload" and the code works just fine.
Thank you very much for your help!
Regards,
Anatoli
|
|
|
|
Aurigma Forums
»
Upload Suite
»
Discussions – ActiveX/Java Uploader
»
How programmacally click on the UPLOAD ALL button on the ImageUploader control
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.