Hi,
I am using ImageUploader applet in firefox 3.0.5
I want to pass parameters to the page i specified as the Action page via querystring.
I set the action property like this:
iu.addParam('Action', 'attachRequirements.aspx?fromId=pd')
but also want to reset the Action property in the javascript method 'ImageUploader1_ShowUploader(s)' to include an additional querystring parameter which is dynamic like this http://localhost/attachRequirements.aspx?fromId=pd&req=foo so that i can retrieve the querystring parameter server side when i process the uploaded files on the Page_Load() method of attachRequirements.aspx.
I am keeping to the convention of using querystring parameters only in this project as told to me by a superior.
On the server side the querystring value of 'req' does not get passed so i receive null all the time.
Note: this does work in IE5.5, 6, 7 but not in firefox 3.0.5
Below is the code used:
Client side
function ImageUploader1_ViewChange()
{
document.getElementById("selectView").selectedIndex = getImageUploader("ImageUploader1").getFolderView();
}
function ImageUploader1_AfterUpload()
{
location.reload(true);
}
function ImageUploader1_HideUploader()
{
document.getElementById('divUpload').style.display = 'none';
}
function ImageUploader1_ShowUploader(awdkey)
{
document.getElementById('hideUpload').style.display = 'none';
document.getElementById('divUpload').style.display = 'block';
getImageUploader("ImageUploader1").Action=getImageUploader("ImageUploader1").getAction() + '&req=' + awdkey;
}
<%
String sessionId = null;
HttpCookie aCookie;
for(int i=0; i<Request.Cookies.Count; i++)
{
aCookie = Request.Cookies[i];
if(!aCookie.HasKeys)
{
if(aCookie.Name == "ASP.NET_SessionId")
{
sessionId = Server.HtmlEncode(aCookie.Value);
}
}
}
sessionId = sessionId.ToString();
%>
function ImageUploader1_BeforeUpload()
{
//getImageUploader("ImageUploader1").AddField('req', oAWDKey);
getImageUploader("ImageUploader1").AddCookie('ASP.NET_SessionId=<%= sessionId %>;');
}
// Enable / disable send button
function ImageUploader1_UploadFileCountChange()
{
var ctl = document.getElementById("<%=this.btnAttach.ClientID %>");
if (getImageUploader("ImageUploader1").getUploadFileCount() > 0)
ovalEnable(ctl);
else
ovalDisable(ctl);
}
function UploadFile()
{
getImageUploader('ImageUploader1').Send();
//var ctl = document.getElementById("<%=this.btnSubmit.ClientID %>");
//ovalEnable(ctl);
return false;
}
function ImageUploader1_Progress(Status, Progress, ValueMax, Value, StatusText)
{
if (Status=="COMPLETE"){
window.location = 'attachRequirements.aspx?' + '<%=Request.QueryString%>'
}
}
var iu = new ImageUploaderWriter("ImageUploader1",650, 400);
//For ActiveX control full path to CAB file (including file name) should be specified.
iu.activeXControlCodeBase = "/shared/sharedcontrols/client/ImageUploader5.cab";
iu.activeXControlVersion = "5,1,10,0";
//For Java applet only path to directory with JAR files should be specified (without file name).
iu.javaAppletJarFileName = "ImageUploader5.jar";
iu.javaAppletCodeBase = "/shared/sharedcontrols/client/";
iu.javaAppletCached = true;
iu.javaAppletVersion = "5.1.10.0";
iu.showNonemptyResponse = "off";
if (iu.getControlType() == "Java")
{
iu.addEventListener("BeforeUpload", "ImageUploader1_BeforeUpload");
}
//Configure appearance.
iu.addParam("PaneLayout", "TwoPanes");
iu.addParam("ShowDebugWindow", "true");
iu.addParam("BackgroundColor", "#ccccff");
iu.addParam("ShowButtons", "False");
iu.addParam("AllowAutoRotate", "True");
iu.addParam("CacheGuiGraphics", "True");
iu.addParam("AllowMultipleSelection", "false");
//Configure License Keys
iu.addParam("LicenseKey", "");
//Configure thumbnail settings.
iu.addParam("UploadThumbnail1FitMode", "Fit");
iu.addParam("UploadThumbnail1Width", "120");
iu.addParam("UploadThumbnail1Height", "120");
iu.addParam("UploadThumbnail1JpegQuality", "60");
//Configure URL files are uploaded to.
iu.addParam('Action', 'attachRequirements.aspx?fromId=<%=Request.QueryString["fromId"]%>')
iu.addParam("FileMask", "<%=mySeries.Web.ScanAndLinkHelper.getAllowableFileTypes() %>");
iu.addParam("MaxFileSize", "2097152 ");
iu.addParam("MessageMaxFileSizeExceededText", "The file [Name] cannot be selected. This file size exceeds the limit ([Limit] KB).");
//Configure URL where to redirect after upload.
//This simply reloads the page to reflect uploaded files
//iu.addParam('RedirectUrl', 'attachRequirements.aspx?fromId=<%=Request.QueryString["fromId"]%>')
iu.addEventListener("Progress", "ImageUploader1_Progress");
//iu.addEventListener("AfterUpload", "ImageUploader1_AfterUpload");
iu.addEventListener("UploadFileCountChange", "ImageUploader1_UploadFileCountChange");
iu.addEventListener("ViewChange", "ImageUploader1_ViewChange");
// No message after upload complete
iu.addParam("MessageUploadCompleteText", "");
iu.instructionsEnabled=true;
iu.instructionsCommon="Image Uploader ActiveX control is necessary to upload "+
"your files quickly and easily. "+
"Installation will take up to few minutes, please be patient. To install Image Uploader, ";
iu.instructionsNotWinXPSP2="please reload page and select \"Yes\" button " +
"when you will see control installation dialog."
iu.instructionsWinXPSP2="please click on Information Bar. After page reloading select \"Yes\" when "+
"you will see control installation dialog.";
//Tell Image Uploader writer object to generate all necessary HTML code to embed
//Image Uploader to the page.
iu.writeHtml();
Server side (C#)
string requirement = Request.QueryString["req"];
- requirement evaluates to null.
Your help would be much appreciated