Set Bucket Name based on Querystring Value

Oct 29, 2009 at 2:25 AM

Hi,

Trying to set the value of a bucket to a QueryString value being passed to the uploader page.  C# novice, so help appreciated.

s3_attach_file.aspx

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="s3_attach_file.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.FileUploader" %>
<%@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.DirectAmazonUploader" %>

<script runat="server">
private void ConfirmUpload(object sender, ConfirmUploadEventArgs e)
{
    // if you don't want to do anything on the server 
    // just leave it empty
}
</script>
<script>
function ConfirmUploadJsFunc(r){
    alert("ConfirmUploadJsFunc: isError:"+r.isError+",isLast:"+r.isLast+",httpStatus:"+r.httpStatus+
            ",index:"+r.index+",bytes:"+r.bytes+",name:\""+r.name+"\", changedName:\""+r.changedName+"\"");
	// window.location = "s3_log_newfile.asp?name="+r.name+"&size="+r.bytes

}
</script>

<!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></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <fjx:FileUploader ID="FileUploader1" runat="server">
        <Adapters>
            <fjx:DirectAmazonUploader OnConfirmUpload="ConfirmUpload" ConfirmUploadJsFunc="ConfirmUploadJsFunc"  
                FileAccess="PublicRead"
                AccessKey="WebConfig:AmazonAccessKey"
                SecretKey="WebConfig:AmazonSecretKey" 
                />
        </Adapters>
    </fjx:FileUploader>
    </div>
    </form>
</body>
</html>

s3_attach_file.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
		com.flajaxian.DirectAmazonUploader myUploader = (com.flajaxian.DirectAmazonUploader)FileUploader1.Adapters[0];
		myUploader.BucketName = Request.QueryString["bucket"];
    }
	
}