0

On referring to this post ASP.net Uploadify Querystring checkbox value, I simply tried to pass the value of a textbox control to FileUploads.aspx.cs but I am unable to get the value, neither using with POST method nor with GET.

<p>
  <asp:TextBox ID="tbTrainingName" runat="server" CssClass="TextBox"></asp:TextBox>
</p>
<div id="fuFiles"></div>  

$(document).ready(function () {
   $('#fuFiles').uploadify({
   // Some options
  'method'   : 'GET',
  'uploader': '_scripts/uploadify.swf',
  'script': 'FileUploads.aspx?trainingName=' + ('[id$=tbTrainingName]').val()  '',
  'cancelImg': '_scripts/cancel.png',
  'auto': 'true',
  'multi': 'true',
  'buttonText': 'Upload Files...',
  'queueSizeLimit': 3,
  'simUploadLimit': 2
  });
  });

   In FileUploads.aspx.cs

   HttpPostedFile uploads = Request.Files["FileData"];
   string file = System.IO.Path.GetFileName(uploads.FileName); 

I am unable to see any thing in Request.QueryString. Could you help me where I am wrong!! Also if you have any good suggession other than uploadify, please suggest, I am using asp.net 4.0.

Community
  • 1
  • 1
Shankar Das
  • 117
  • 1
  • 4
  • 14

1 Answers1

1

It's all in your timing...

In your example code you are setting the script property from the dropdown value (e.g. using ('[id$=tbTrainingName]').val()) at the time the uploadify is created (i.e. at page load).

You need to set the value after the file is selected, but before the file begins to upload.

We wound up turning off the auto property and using a separate upload button to trigger the upload. We change the form data when that upload button was clicked, but before we tell uploadify to begin. On the server we extracted the user selections from the form data.

*Note: We are using the latest uploadify

iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202