Forums

Welcome Guest Search | Active Topics | Members

how to get number of files uploaded? Options
teja
Posted: Monday, January 31, 2005 2:37:00 PM
Rank: Member
Groups: Member

Joined: 1/31/2005
Posts: 6
Points: 0
Hi,

Can anyone tell me how I can get the number of files uploaded. I want this to be displayed in teh "redirectURL" page. How can I add this info dynamically to the page??

thanks,
Teja
Fedor
Posted: Tuesday, February 01, 2005 12:33:00 AM

Rank: Advanced Member
Groups: Administration , Member

Joined: 7/28/2003
Posts: 1,235
Points: -208
Location: WA, US
There are two ways to implement it:

1st Way

We can get count of uploaded files using UploadFileCount property. We can handle changing of this property using UploadFileCountChange event. In handler of this event we just need to update RedirectUrl property and pass file count to redirect page using query string:

Code:
<object id="ImageUploader1" ... >
...
</object>

<script for="ImageUploader1" event="UploadFileCountChange()">
ImageUploader1.RedirectUrl="MyRedirectPage.asp?filecount="+ImageUploader1.UploadFileCount;
</script>


2nd Way

On server-side we can get file count from uploaded data using FileCount field. Upload processing page (the one specified in Action param) should return to browser the string which contains file count:

Code:
Response.Clear
Response.Write objUpload.Form("FileCount")
Response.End


On client side we need to set RedirectUrl property empty and make redirection manualy in Progress event handler:

Code:
<object id="ImageUploader1" ... >
<param name="RedirectUrl" value="">
</object>

<script for="ImageUploader1" event="Progress(Status, Progress, ValueMax, Value, StatusText)">
if (Status == "COMPLETE"){
    //StatusText contains response from  
    window.location="MyRedirectPage.asp?filecount=" + StatusText;
}
</script>



In both case we can easy show filecount on redirected page using following code:

Code:
<%
Response.Write Request.QueryString("filecount")
%>



========================================================
02/14/2008, Fedor
This topic is out of date.

You should use iuembed.js syntax now.



Code:
<script type="text/javascript" src="iuembed.js"></script>
<script type="text/javascript">
function ImageUploaderID_UploadFileCountChange() {
      var upl = getimageUploader("ImageUploaderID");
      upl.setRedirectUrl("MyRedirectPage.asp?filecount=" + upl.getUploadFileCount());
}
var iu = new ImageUploaderWriter("ImageUploaderID", 610, 500);
//...params...
//...other event listeners...
iu.addEventListener("UploadFileCountChange", "ImageUploaderID_UploadFileCountChange");
//...other event listeners...
iu.writeHtml();
</script>



Code:
<script type="text/javascript" src="iuembed.js"></script>
<script type="text/javascript">
function ImageUploaderID_Progress(Status, Progress, ValueMax, Value, StatusText) {
    //StatusText contains response from server
    window.location="MyRedirectPage.asp?filecount=" + StatusText;

}
var iu = new ImageUploaderWriter("ImageUploaderID", 610, 500);
//...params...
//...other event listeners...
iu.addEventListener("Progress", "ImageUploaderID_Progress");
//...other event listeners...
iu.writeHtml();
</script>


========================================================



Best regards,
Fedor Skvortsov
teja
Posted: Tuesday, February 01, 2005 8:33:00 AM
Rank: Member
Groups: Member

Joined: 1/31/2005
Posts: 6
Points: 0
hi fedor,

thaks a lot.. you solved my doubts..


regards,
Teja
Users browsing this topic
Guest


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.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Yet Another Forum.net version 1.9.1.6 running under Cuyahoga.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.