[CLOSED] MultiUpload sending parameters

  1. #1

    [CLOSED] MultiUpload sending parameters

    Hi,

    Im using Multiupload so I can upload multiple files at once.
    The files are received and processed by an .ashx file.
    It works fine!

    How can send more parameters to this .ashx page from the inicial page?
    Last edited by Daniil; Jun 24, 2014 at 10:03 PM. Reason: [CLOSED]
  2. #2
    Maybe adding your values to the <PostParams> can help.
    Geoffrey McGill
    Founder & CEO
  3. #3
    Can I see some examples?
    Thank you.
  4. #4
    Sure. Can you provide a simplified sample demonstrating what you have tested so far with PostParams. That will help get us started.
    Geoffrey McGill
    Founder & CEO
  5. #5
    Thats what i have so far:

    <ext:MultiUpload 
         ID="MultiUpload1" 
         runat="server"
         OnFileUpload="MultiUpload1_FileUpload"
         FileDropAnywhere="True"
         FileSizeLimit="500 MB"
         FileTypes="*.*"
         FileTypesDescription="All Files"
         FileUploadLimit="500"
         FileQueueLimit="0" 
         UploadUrl="~/UploadDocumento.ashx" 
         AutoScroll="False">
         <PostParams>
            <ext:Parameter Name="IdClass" Value="ContentPlaceHolder1_DDIdClass.value" Mode="Raw" Encode="true"  />
        </PostParams>
         <Listeners>
             <SwfUploadLoadFailed Fn="loadFailed" />
             <FileQueued Fn="BeginUpload" />
             <FileSelected Fn="fileSelected" />
             <UploadStart Handler="updateRecord(file.id, 'status', 'Sending');" />
             <UploadProgress Handler="updateRecord(file.id, 'progress', Math.round(bytesComplete / bytesTotal));" />
             <UploadComplete Handler="updateRecord(file.id, 'progress', 1 );updateRecord(file.id, 'status', 'Uploaded' );" />
             <UploadAborted Handler="updateRecord(file.id, 'status', 'Aborted');" />
             <UploadRemoved Handler="var store = this.up('grid').store; store.remove(store.getById(file.id));" />
             <UploadError Fn="uploadError" />
             <FileSelectionError Fn="fileSelectionError" />
         </Listeners>
         <Button>
            <ext:Button Text="Pesquisar..." />
        </Button>
     </ext:MultiUpload>
    Should "ContentPlaceHolder1_DDIdClass.value" be replaced by something else?
    Its here:

    <ext:SelectBox ID="DDIdClass" runat="server" DisplayField="ClassTitulo" ValueField="IdClass" FieldLabel="Classifica??o" OnDirectSelect="DDIdClass_OnDirectSelect" AutoPostBack="False" CausesValidation="True">
        <Store>
            <ext:Store ID="Store3" runat="server" DataSourceID="SqlDataSourceClassList">
                <Model>
                    <ext:Model ID="ModelClass" runat="server">
                        <Fields>
                            <ext:ModelField Name="IdClass" />
                            <ext:ModelField Name="ClassTitulo" />
                        </Fields>
                    </ext:Model>
                </Model>            
            </ext:Store>    
        </Store>
    </ext:SelectBox>
    The page UploadDocumento.ashx uses this code to lood for the IdClass parameter:

    IdClass = Convert.ToInt32(context.Request["IdClass"]);
    Thanks again!
    Last edited by geoffrey.mcgill; Jun 24, 2014 at 9:26 PM.
  6. #6
    It worked!
    I've used this:

    <PostParams>
        <ext:Parameter Name="IdClass" Value="Ext.encode(#{DDIdClass}.value)" Mode="Raw" Encode="false"/>
    </PostParams>
    Also, the encode=false removes extra caracters when receiving the data and makes my work simpler.

    :D

    Thank you!
    Last edited by geoffrey.mcgill; Jun 24, 2014 at 9:26 PM.
  7. #7
    Hi all !

    Well, I´m trying to do the same but in MVC 3.2.1, I don´t know how to read the
    .PostParams()
    My code looks like this:
    X.MultiUpload()
                .ID("LayoutsResourceInputResourcesAdd")
                .FileSizeLimit("10 MB")
                .Namespace("Resources")
                .AutoStartUpload(true)
                .FileUploadLimit(10)
                .FileQueueLimit(0)
                .FileTypes("*.*")
                .UploadUrl(Url.Action("CreateResource"))            
                    .PostParams(x => { 
                         new Parameter("ResourceID", "App.LayoutsResourcesTreeGridResources.selection.data.resourceID", ParameterMode.Raw);
                         new Parameter("ResourceName", "App.LayoutsResourcesTreeGridResources.selection.data.resourceName", ParameterMode.Raw);
                         new Parameter("ResourceSize", "App.LayoutsResourcesTreeGridResources.selection.data.resourceSize", ParameterMode.Raw);
                         new Parameter("ResourceDate", "App.LayoutsResourcesTreeGridResources.selection.data.resourceDate", ParameterMode.Raw);
                         new Parameter("ResourceType", "App.LayoutsResourcesTreeGridResources.selection.data.resourceType", ParameterMode.Raw);
                    })
                    )
    And:
    public DirectResult CreateResource( FileUploadEventArgs a)
            {
    ...
    }
    I have seen other posts using
    context.Request["IdClass"]
    or
    Read it directly from Request collection
    , but I guess it's only for WebForms, not MVC.
    What should I add in that code to read that kind of parameters?

    Thanks in advance
  8. #8
    Hello @VilcheS,

    In MVC please use HttpContext.Request.Params["parameter name"].

    View
    @{
        var X = Html.X();
    }
    
    <!DOCTYPE html>
    <html>
    <head>
        <title>Ext.Net.MVC v3 Example</title>
    </head>
    <body>
        @X.ResourceManager()
    
        @(X.MultiUpload()
            .ID("MultiUpload1")
            .UploadUrl(Url.Action("Upload"))
            .PostParams(p => p.Add(new { testParameter = "test parameter value" }))
        )
    
        @X.Button().Text("Upload").Handler("App.MultiUpload1.startUpload();")
    </body>
    </html>
    Controller
    public ActionResult Upload(FileUploadEventArgs a)
    {
        X.Msg.Alert("PostParams", HttpContext.Request.Params["testParameter"]).Show();
    
        return this.Direct();
    }
  9. #9
    Works!

    I had to do little changes in my code:
    .PostParams(p => {
        p.Add(new Parameter ( "ResourceID" , "App.LayoutsResourcesTreeGridResources.selection.data.resourceID", ParameterMode.Raw ));
        p.Add(new Parameter (  "ResourceName" , "App.LayoutsResourcesTreeGridResources.selection.data.resourceName", ParameterMode.Raw ));
        p.Add(new Parameter (  "ResourceSize" , "App.LayoutsResourcesTreeGridResources.selection.data.resourceSize", ParameterMode.Raw ));
        p.Add(new Parameter (  "ResourceDate" , "App.LayoutsResourcesTreeGridResources.selection.data.resourceDate", ParameterMode.Raw ));
        p.Add(new Parameter (  "ResourceType" , "App.LayoutsResourcesTreeGridResources.selection.data.resourceType", ParameterMode.Raw ));
    })
    because I wanted a value from the client like "10090", and not "App.LayoutsResourcesTreeGridResources.selection.d ata.resourceID", but it works :)

    Thx again Daniil

Similar Threads

  1. Replies: 0
    Last Post: Apr 28, 2014, 2:18 PM
  2. Replies: 8
    Last Post: Apr 22, 2014, 7:42 PM
  3. DropdownField value is not sending
    By inf2k in forum 2.x Help
    Replies: 2
    Last Post: Apr 06, 2014, 2:21 PM
  4. [CLOSED] HttpWriteProxy sending parameters in querystring
    By tlfdesarrollo in forum 1.x Premium Help
    Replies: 2
    Last Post: Nov 01, 2013, 5:48 PM
  5. Replies: 6
    Last Post: Sep 24, 2013, 6:55 AM

Tags for this Thread

Posting Permissions