ASP.net Uploadify Querystring文本框值。

时间:2022-12-02 12:39:28

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.

关于这个post ASP.net Uploadify Querystring checkbox值,我只是尝试将textbox控件的值传递给FileUploads.aspx。但是我无法得到这个值,也不能用POST方法,也不能用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.

我无法在Request.QueryString中看到任何东西。你能帮我一下吗?如果你有什么好的建议,请建议我使用asp.net 4.0。

1 个解决方案

#1


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).

在您的示例代码中,您将从下拉值中设置脚本属性(例如,在创建uploadify时(即在页面加载时)使用(“[id$=tbTrainingName]”).val()。

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.

我们关闭了自动属性,并使用一个单独的上传按钮来触发上传。当我们点击上传按钮时,我们会改变表单数据,但是在我们告诉uploadify开始之前。在服务器上,我们从表单数据中提取用户选择。

*Note: We are using the latest uploadify

*注:我们正在使用最新的uploadify。

#1


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).

在您的示例代码中,您将从下拉值中设置脚本属性(例如,在创建uploadify时(即在页面加载时)使用(“[id$=tbTrainingName]”).val()。

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.

我们关闭了自动属性,并使用一个单独的上传按钮来触发上传。当我们点击上传按钮时,我们会改变表单数据,但是在我们告诉uploadify开始之前。在服务器上,我们从表单数据中提取用户选择。

*Note: We are using the latest uploadify

*注:我们正在使用最新的uploadify。