Problem passing several parameters in URL

I use a redirection to a URL action in a button (Apex 4.0.2) and I can't seem to understand how to properly complete multiple page items. I can use a parameter and the value is passed; However, when I try to pass two only the first element is filled. I don't know there is something wrong with my syntax, I don't know what.

I use the $x () function I found in another thread here and as a sidebar, where can I find documentation on this feature? There seems to be little information here above.
javascript:redirect('f?p=101:13:&SESSION.::NO::P13_REQ_ID,P13_REQUEST_NUMBER:'+$x('P3_REQUEST_ID').value,+$x('P3_REQ_NUMBER').value);
Two items being passed are valid, because I can remove the comma from the value param string and two values of the element passed are concatenated into the first param element.

Hello

Try this:

javascript:redirect('f?p=101:13:&SESSION.::NO::P13_REQ_ID,P13_REQUEST_NUMBER:'+$x('P3_REQUEST_ID').value + ',' + $x('P3_REQ_NUMBER').value);

Kind regards
Dirk

Tags: Database

Similar Questions

  • A url that refers to an application process pass several parameters?

    Hello

    I have a page in an application that uses pl/sql to generate a list of links.

    The purpose of each link is to call another pl/sql procedure which in turn opens / runs an external report on the application of the APEX (or a call to the server to Oralce apps generate direct or pull clob is stored in the database). If the URL call the pl/sql procedure directly, I lose session state and doesn't remember who the user is. To maintain session state made URL refers to an APPLICATION_PROCESS. I would like to pass a number of parameters, but may only move one, using javascript to pass the value to a hidden element that is accessible in the procedure called by the APPLICATION_PROCESS.

    Can I pass several parameters?
    My URL:
    https:// < Server > / pls/apex/f? p = V('APP_ID'):0:V('APP_SESSION'):APPLICATION_PROCESS = MY_PROCESS:NO:P1NAME:P1VALUE

    I was able to pass all parameters P1VALUE and using a special character delimiter he break up once again in the javascript code, but would rather not.

    Thanks for any help,
    Jock

    Did you mean something like this?

    https:///pls/apex/f? p = V('APP_ID'):0:V('APP_SESSION'):APPLICATION_PROCESS = MY_PROCESS:NO:P1NAME, P2NAME, P3NAME:P1VALUE, P2VALUE, P3VALUE

    Best regards, Kostya Proskudin

  • How to pass several parameters in 10 g reports

    Hello
    I'm calling the oracle 10grel2 report and I uses run_Report_object and web_show to display the output. I could able to generate the report with a parameter but I tried several settings but its display of the
    report without data headers. If I turn the settings directly from the url out of the projection, what may be wrong with my code. Pls find the line that I put multiple parameters. A report on the parameter works very well. Report running and output pdf with only titles without data


    SET_REPORT_OBJECT_PROPERTY (REPID, REPORT_OTHER, 'pdate =' |: D T.TXTBEDATE |') EDATE =' | : D T.TXTEDATE: ' paramform = no ");"

    Rgds
    Marie Louise

    Hello

    Add a space before the name edate parameter:

    SET_REPORT_OBJECT_PROPERTY (REPID, REPORT_OTHER, 'pdate =' |: D T.TXTBEDATE |' edate ='|: D T.TXTEDATE: ' paramform = no "");

    Concerning

  • How to pass several parameters to vo

    Hello

    I wrote a serializable method in co

    String orgcode1 = pageContext.getTransactionTransientValue("asset12").toString ();

    String assetid = pageContext.getTransactionTransientValue("asset1").toString ();

    Np1 [Serializable] = {orgcode1, assetid};

    am.invokeMethod ("xxEx1", np1);

    I wrote in AMImpl

    public void xxEx1 (String na2, na3 String)

    {

    internalcpVOImpl vo = getinternalcpVO1();

    Wc1 = string "organization_code =" "+ na2 +" ' ";"

    Wc string = "SEGMENT1 = '" + na3 + "'"; "

    vo.setWhereClause (null);

    vo.setWhereClause (wc1);

    vo.setWhereClause (wc);

    vo.executeQuery ();

    }

    I need to add that where the classes in this vo

    SELECT distinct meav.c_attribute1, msi.segment1, mp.organization_code

    OF csi_item_instances cii,.

    MSI mtl_system_items_b,

    mtl_eam_asset_attr_values Meave,

    mtl_parameters mp

    WHERE Meave. Serial_number = ITC. SERIAL_NUMBER

    And Meave. MAINTENANCE_OBJECT_ID = cii. INSTANCE_ID

    And meav.ORGANIZATION_ID = cii. LAST_VLD_ORGANIZATION_ID

    And meav.attribute_category = 'Active common Details'

    And msi.inventory_item_id = cii.inventory_item_id

    And meav.organization_id = mp.organization_id

    -1 (nedd add vo.setWhereClause (wc1);)

    -2 (vo.setWhereClause (wc);)

    It adds only first parameter of the class where it does not add second parameter where class please give me any solution

    Kind regards

    Maha

    Hello Maha

    I hope that you want to pass

    organization_code = na2

    and SEGMENT1 = na3;

    use after

    WhereClause = string "organization_code =" "+ na2 +" ' AND SEGMENT1 = ' "+ na3 +" ' ";"

    vo.setWhereClause (null);

    vo.setWhereClause (whereClause);

    vo.executeQuery ();

    Concerning

    Marie Lise S

  • passing several parameters to work

    Hello

    For some historical reason, there are some clients who share the same group id in our customer database.

    We have a report that has a client_name and/or customer_number as parameter multiple_value and it works fine. However, the user is now asking a customer number if there is requested there is another customer who shares the same party_id, while other clients should also be included in the report.

    If I use a condition, or I use a function to find the another customer with the same party_id, it becomes a problem if more than one client is selected in the settings.

    Is there a solution, or will we have to change the setting so that a single value is allowed?

    Thank you.
    Leah

    Hi Lea,.

    It's "apps.jafi_disco_utils_pkg" is a function? A function always returns a single value. If it is your function please try to avoid the function and you try to create a State with 'IN' operator having user enter multiple values option.

    See you soon

  • Problem in passing several Arguments for simultaneous program

    Hello

    I need to pass two stamped in my simultaneous program

    but I am facing problem while adding the second parameter in the code below

    Please suggest how to pass several parameters for the simultaneous program
        Vector cpArgs = new Vector();
        cpArgs.addElement(shipmentId);
        cpAgrs.addElement(addId);
        System.out.println("Args"+ cpArgs);
    It's my submission of application code
        public int submitRequest(String shipmentId, String addId) throws Exception {  
        try {
          OADBTransaction tx = (OADBTransaction)getDBTransaction();
        java.sql.Connection pConncection = tx.getJdbcConnection();
        ConcurrentRequest cr = new ConcurrentRequest(pConncection);
            cr.addLayout("XXAPL", "XXAPLPORMSD", "en", "US", "RTF");
        String applnName = new String("XXAPL"); 
        System.out.println("ApplName"+ applnName);
        String cpName = new String("XXAPLPORMSD"); 
        System.out.println("Concc Name"+ cpName);
        String cpDesc = null;
        Vector cpArgs = new Vector();
        cpArgs.addElement(shipmentId);
        cpAgrs.addElement(addId);
        System.out.println("Args"+ cpArgs);
         
            int requestId = cr.submitRequest(applnName, cpName,cpDesc, null,  false, cpArgs);        
    
        tx.commit();    
    
        return requestId;
    
        } 
         
        catch (RequestSubmissionException e) {
        OAException oe = new OAException(e.getMessage());
        oe.setApplicationModule(this);
        throw oe;
    
        }
            catch(Exception exception)
            {
            throw OAException.wrapperException(exception);
            }
    
        }
    Krishna

    I did most of the changes. IAM do not know why the error is come

    This is the reason why...

    It should be cpA rg s

    NOT

    cpA gr s

    Thank you
    -Anil
    http://oracleanil.blogspot.com

  • USING SEVERAL PARAMETERS FOR GET_SEARCH_RESULTS WITH THE HELP OF API RDCI

    Using Oracle Web Center content Web Service, I'm able to pass several parameters to the search entry to GET_SEARCH_RESULTS.

    " < envelope soap: xmlns:soap = ' http://schemas.xmlsoap.org/SOAP/envelope/ ">

    " < soap: Body = xmlns:ns1 ' http://www.Oracle.com/UCM "> "

    < ns1:GenericRequest webKey = "cs" >

    < ns1:Service IdcService = "GET_SEARCH_RESULTS" >

    < ns1: User / >

    < ns1:Document >

    <!-ns1:Field name = "QueryText" > xCUSTOMER_MSISDN & lt; contains > '044444444' < / ns1:Field->

    < name ns1:Field = "QueryText" > xCHANNEL_ID & lt; contains > '11222212' < / ns1:Field >

    AND

    < name ns1:Field = "QueryText" > xCUSTOMER_id & lt; contains > '08848484848' < / ns1:Field >

    AND

    < name ns1:Field = "QueryText" > xCHANNEL & lt; contains > 'ISL' < / ns1:Field >

    < / ns1:Document >

    < / ns1:Service >

    < / ns1:GenericRequest >

    < / soap: Body >

    < / envelope soap: >

    How do I pass several entrance to search for GET_SEARCH_RESULTS parameter when you use the RDCI API?

    I have this code RDCI, but I get parse error as soon as I try out several settings. It works very well with a single parameter. Please advice

    Public Shared Sub {search (String content_dDocName)

    String queryText = "dDocName < match > '" + content_dDocName + "'";

    create the binder

    DataBinder searchResultBinder = idcClient.createBinder ();

    fill the binder with the settings

    searchResultBinder.putLocal ("IdcService", "GET_SEARCH_RESULTS");

    searchResultBinder.putLocal ("QueryText", queryText);

    searchResultBinder.putLocal ("ResultCount", "20");

    run the query

    ServiceResponse searchResponse;

    print a Boolean = false;

    for (int counter = 0; counter < 1000; counter = counter + 1) {}

    try {}

    searchResponse = idcClient.sendRequest (userContext, searchResultBinder);

    If (! print) {}

    myExecutable.logEvent ("GET_SEARCH_RESULTS successful call.");

    print = true;

    }

    } catch (IdcClientException e) {}

    myExecutable.logEvent ("GET_SEARCH_RESULTS failed");

    e.printStackTrace ();

    return;

    }

    DataBinder searchData;

    try {}

    searchData = searchResponse.getResponseAsBinder ();

    } catch (IdcClientException e) {}

    myExecutable.logEvent ("cannot get the answer.");

    e.printStackTrace ();

    return;

    }

    DataResultSet search results = searchData.getResultSet ("SearchResults");

    If (searchResults.getRows () .isEmpty ()) {}

    continue;

    }

    myExecutable.logEvent ("successfully obtained response - (s) dDocName ' following was found:" ");

    Iterator it = searchResults.getRows () .iterator ();

    While (it.hasNext ()) {}

    Date of birth of DataObject = (DataObject) it.next ();

    myExecutable.logEvent (dob.get ("dDocName"));

    }

    return;

    }

    myExecutable.logEvent ("failed to get a response at the time given.");

    }

    You can provide several search parameter to RIDC as follows:

    dataBinder.putLocal ("QueryText", 'xOriginalServiceId 'DISO' xApprover 'fmwtuser' ')

    In above query, I gave 2 search parameters.

    You can replace OR with AND & also you can replace 'contains' by 'correspondences' according to your requirement.

    -Prashant

  • passing multiple parameters to a portlet

    Hi all

    I created a form of portlet a taskflow using the WSRP producer connection I add this portlet in the JSF page a new application.
    1. is it possible to create a portlet that accepts multiple parameters?
    2. is it possible to map a portlet from method to method in the new application.
    3. is there an implicit event that can be passed when all parameters are passed to the portlet.

    What is my requirement:-I send some 4-5 (String) parameters of the new application for the purposes of the portlet.
    What would be the sequence in which would be called the setters of this parameters in the Portlet application?

    can you please me if this is possible and how to do it. A tutorial would be useful.

    Kind regards
    ND

    Your question is associated with WebCenter and you must request this in the forum {forum: id = 354}.

    Anyway, you can pass several parameters to a portlet. Set the parameters as parameters to the corresponding defined TaskFlow. When the taskflow is wrapped as a portlet producer by the JSF Portlet Bridge all taskflow parameters to expose as a separate navigation portlet settings. If you consume the portlet to a page, then the portlet parameters will be bound to variables PageDef and you can use these variables to pass values of parameter to the portlet. If you need to re - send the new parameter values when running, just set the corresponding pageDef variables and update the tag by PPR. Don't forget to mark the binding region of the portlet in the PageDef as RefreshIfNeeded, otherwise it will not get the new values and is not refreshed.

    Read the next article in the documentation on the use of the navigation settings to link contextual portlets:
    http://download.Oracle.com/docs/CD/E14571_01/WebCenter.1111/e10148/jpsdg_pages.htm#CHDJABHD

    If you have additional questions, please ask them in the WebCenter forums.

    Dimitar

  • Passing multiple parameters to a treelist using a link

    Hello

    I was wondering if I could pass several parameters via a list of tree binding.

    I have the following SQL query to my tree:

    Select 'TREE_ID_SK' id,
    "TREE_PARENT_ID" the nest,
    Name of "TREE_NAME."
    ? p = & APP_ID.:80: & SESSION. : NO::P80_TREE_ID_SK :'|| "" Link TREE_ID_SK "
    null a1,
    null A2
    of ' #OWNER # '. " TREE_LIST ".

    I want to spend the TREE_NAME in the link. Is this possible?

    Thanks in advance,
    ca84

    Hi ca84,

    Yes, it is possible to pass several parameters via your link tree. You must update your link to something similar to the following, to pass the TREE_NAME value to an existing page item, would simply say P80_TREE_NAME:

    Select 'TREE_ID_SK' id,
    "TREE_PARENT_ID" the nest,
    Name of "TREE_NAME."
    ? p = & APP_ID.: 80: & SESSION. : NO::P80_TREE_ID_SKP80_TREE_NAME:'|| "" TREE_ID_SK "| «, » || "" TREE_NAME " link,.
    null a1,
    null A2
    of ' #OWNER # '. " TREE_LIST ".

    I hope this helps.
    Kind regards
    Hilary

  • Appeal with several parameters of the URL

    Hello!

    I'm unable to call a procedure by URL with several parameter, a parameter is passed to the following example, the syntax would be like spending several parameters?

    # OWNER #. PK_UTIL. PKB_TXT? En_param1 = xxx

    How to include the second parameter? I tried several and could not happen.

    Thank you

    Márcio Goncalez

    This isn't really a question of APEX but more close mod_plsql or the apex listener I think?

    Have you tried?

    # OWNER #. PK_UTIL. PKB_TXT? En_param1 = xxx & En_param2 = yyy

    James

  • Passing parameters in URL

    Hello

    Bit of a newbie here question.

    I am passing the parameter via URL:

    ? IMG = study_1_img

    In the next page, I'll put it as a variable:

    < CFSET image = "#URL.img #" >

    I then ask my DB:

    SELECT #image # FROM [tablename]

    However, when I got out, it returns the value of the variable:

    < CFOUTPUT >
    #image #.
    < / CFOUTPUT >

    What I want is the value of the query, not the variable. What should I do?

    Help would be much appreciated!

    Thank you all; in the end, I went for a different solution, but the solution to my original problem was indeed:

    Thanks a lot for all the help

  • Problem AJAX (problems of passing two parameters to an application process)

    Hello

    I need to pass two parameters to a procedure of application via an AJAX request.

    All are my events show below, as you can see that the second p_arg_values does not contain any value. Its as if this get.add('TEMPORARY_ITEM_2',pThis2.value); line is ignored. What changes can I make to do this work?


    P2_QUERY_GROUP (the HTML Form element attributes)
    OnChange = "get_query_select_list_xml (This, 'P2_QUERY', 'P2_PRODUCT_GROUP')" "
    function get_query_select_list_xml(pThis,pSelect,pThis2){ 
        var l_Return = null;
        var l_Select = html_GetElement(pSelect);
        var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
                  'APPLICATION_PROCESS=Query_Select_XML',0);
        get.add('TEMPORARY_ITEM',pThis.value);
        get.add('TEMPORARY_ITEM_2',pThis2.value);
        gReturn = get.get('XML');
        if(gReturn && l_Select){
            var l_Count = gReturn.getElementsByTagName("option").length;
            l_Select.length = 0;
            for(var i=0;i<l_Count;i++){
                var l_Opt_Xml = gReturn.getElementsByTagName("option");
    appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'),
    l_Opt_Xml.firstChild.nodeValue)
    }
    }
    get = null;
    }

    Query_Select_XML (Application Process)
    declare
    l_counter number;
    l_o_name varchar2(2000);
    begin
    owa_util.mime_header('text/xml', FALSE );
    htp.p('Cache-Control: no-cache');
    htp.p('Pragma: no-cache');
    owa_util.http_header_close;
    htp.prn('<select>');
    for rec in (select QUERY, ID
    from     TECH_DB_VIDEO_QUERY
    WHERE instr(QUERY_GROUPS,addzero(:TEMPORARY_ITEM))>0
    AND instr(PRODUCT_GROUPS,addzero(:TEMPORARY_ITEM_2))>0
    ORDER BY QUERY)
    loop
    htp.prn('<option value="' || rec.id || '">' || rec.query || '</option>');
    end loop;
    htp.prn('</select>');
    end;


    FIREBUG Output

    Post
    p_arg_names     TEMPORARY_ITEM
    p_arg_names     TEMPORARY_ITEM_2
    p_arg_values     16
    p_arg_values     
    p_flow_id     107
    p_flow_step_id     0
    p_instance     3349916470781784
    p_request     APPLICATION_PROCESS=Query_Select_XML

    Response
    <select></select>

    Regards
    Adam

    Adam:

    The second 'get.add' should be

    get.add('TEMPORARY_ITEM_2', $x(pThis2).value);
    

    CITY

  • see link with several parameters

    Hi all:
    I use af:golink to call a new page with different parameters like the code below:
     <af:goLink text="Run Report" styleClass="xes" destination="/printreportservlet?reporttype=pdf&filename=new_report.jasper"  targetFrame="_blank"/>
    but when I use it cann't page display "website cannot display the page.

    but when I use a single parameter as:
     <af:goLink text="Run Report" styleClass="xes" destination="/printreportservlet?reporttype=pdf"  targetFrame="_blank"/>
    or
    <af:goLink text="Run Report" styleClass="xes" destination="/printreportservlet?filename=new_report.jasper"  targetFrame="_blank"/>
     
    It works successfully,
    so is there any problem to send several parameters while asking us to servlet.

    Best regards

    What happens if you put this URL in the address bar directly, it works? If it isn't, then it seems that the problem is with your servlet. If this does not work, try to escape the ampersand in the URL. I can't paste the value here, as the forum he transformed into an ampersand, but you can read [url http://articles.techrepublic.com.com/5100-10878_11-5032714.html] this

    JOhn

  • Pass the parameters to the callback SequenceFilePostStep

    I have to call a sous-suite with several parameters in case of RunTimeError one of my steps in the main sequence. I would replace the SequenceFilePostStepRuntimeError callback for this.

    The recall starts ok but no parameter not passed. I don't see a way to explicitly set the parameters of the callback call (as we have for calls to subsequence) so I just created parameters of the same name, in the MainSequence and the SequenceFilePostStepRuntimeError.

    I saw this post , but it does not describe how to pass parameters to a callback.

    Please see attached the sequence. The SequenceFilePostStep callback is used for demonstration purposes.

    Hello

    One way that you can try.

    Instead of having Parameters.Message use a local variable. Replace your Parameters.Message Locals.Message in two clips (MainSequence and SequenceFilePostStep).

    In the SequenceFilePostStep the Locals.Message a "Allow the spread of the appellant" (select right mouse click and variable of Locals.Message, you should see two options)

    In the MainSequence put the Locals.Message to "spread of subsequence.

    Make sure that change you the MessagePopup to use local variables > message and Locals.Message with your message in your approach to expression.

    Now when you run your MainSequence you should see your message in the dialog box.

    I hope this helps.

    Concerning

    Ray Farmer

  • How to pass the parameters in the http post method?

    Hello

    I want to download the mp3 file on server and I need to pass two parameters with the post method.

    Here is my code for this.

                          String userid="id_user=8379";
                  String filename="trackName=sample.mp3";
                  String params=userid+"&"+filename;            
    
                            httpcon=(HttpConnection)Connector.open("http://api.upload.com/gStorage/uploadSong?output=json",Connector.READ_WRITE);
                httpcon.setRequestMethod(HttpConnection.POST);
                httpcon.setRequestProperty("Content-type","application/x-www-form-urlencoded");
                httpcon.setRequestProperty("Content-type","audio/mpeg3");
                os=httpcon.openOutputStream();
                os.write(params.getBytes("UTF-8"));
                fc=(FileConnection)Connector.open("file:///E:/sample.mp3",Connector.READ_WRITE);
                fileis=fc.openInputStream();
                bos=new ByteArrayOutputStream();
                byte[] data=new byte[50000];
                int ch;
                while ((ch=fileis.read(data,0,data.length))!=-1) {
                    bos.write(data,0,ch);
                }
                os.write(bos.toByteArray());
                os.close();
                System.out.println("Response code From server"+httpcon.getResponseCode());
                if(httpcon.getResponseCode()!=HttpConnection.HTTP_OK)
                {
                    System.out.println("Failed to upload bytes");
                }
                else
                {
                    //is=httpcon.openInputStream();
                    DataInputStream dis=httpcon.openDataInputStream();
                    int ch1;
                    StringBuffer buffer1=new StringBuffer();
                    while ((ch1=dis.read())!=-1) {
                        buffer1.append((char)ch1);
                    }
                    System.out.println("Response From Server"+buffer1.toString());
                }
            } i am getting response code ok but fail to upload file.
    

    may I passing the parameter in the wrong way?

    thankx.

    Hello

    Nitin I currently do a midlet project.

    So I used multipart post method.

    I just read this article. http://MindTouch.firmstep.com/AchieveForms/Design_Guide/Integration_Actions/types/HTTP_POST#top

    package com.http.main;
    
    import java.io.ByteArrayOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Enumeration;
    import java.util.Hashtable;
    
    import javax.microedition.io.Connector;
    import javax.microedition.io.HttpConnection;
    
    import com.sun.midp.io.BufferedConnectionAdapter;
    
    public class HttpMultipartRequest
    {
        static final String BOUNDARY = "----------V2ymHFg03ehbqgZCaKO6jy";
    
        byte[] postBytes = null;
        String url = null;
    
        public HttpMultipartRequest(String url, Hashtable params, String fileField, String fileName, String fileType, byte[] fileBytes) throws Exception
        {
            this.url = url;
    
            String boundary = getBoundaryString();
    
            String boundaryMessage = getBoundaryMessage(boundary, params, fileField, fileName, fileType);
    
            String endBoundary = "\r\n--" + boundary + "--\r\n";
    
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
    
            bos.write(boundaryMessage.getBytes());
    
            bos.write(fileBytes);
    
            bos.write(endBoundary.getBytes());
    
            this.postBytes = bos.toByteArray();
    
            bos.close();
        }
    
        String getBoundaryString()
        {
            return BOUNDARY;
        }
    
        String getBoundaryMessage(String boundary, Hashtable params, String fileField, String fileName, String fileType)
        {
            StringBuffer res = new StringBuffer("--").append(boundary).append("\r\n");
    
            Enumeration keys = params.keys();
    
            while(keys.hasMoreElements())
            {
                String key = (String)keys.nextElement();
                String value = (String)params.get(key);
    
                res.append("Content-Disposition: form-data; name=\"").append(key).append("\"\r\n")
                    .append("\r\n").append(value).append("\r\n")
                    .append("--").append(boundary).append("\r\n");
                System.out.println("****In while Loop:-****"+res);
            }
            res.append("Content-Disposition: form-data; name=\"").append(fileField).append("\"; filename=\"").append(fileName).append("\"\r\n")
                .append("Content-Type: ").append(fileType).append("\r\n\r\n");
            return res.toString();
        }
    
        public byte[] send() throws Exception
        {
            HttpConnection hc = null;
    
            InputStream is = null;
    
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
    
            byte[] res = null;
    
            try
            {
                hc = (HttpConnection) Connector.open(url);
    
                hc.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + getBoundaryString());
                hc.setRequestProperty("Content-Length",postBytes+"");
    
                hc.setRequestMethod(HttpConnection.POST);
    
                OutputStream dout = hc.openOutputStream();
    
                dout.write(postBytes);
                dout.close();
    
                int ch;
    
                is = hc.openInputStream();
                StringBuffer buffer=new StringBuffer();
    
                while ((ch = is.read()) != -1)
                {
                    bos.write(ch);
                    buffer.append((char)ch);
                }
                res = bos.toByteArray();
                System.out.println(buffer.toString());
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            finally
            {
                try
                {
                    if(bos != null)
                        bos.close();
    
                    if(is != null)
                        is.close();
    
                    if(hc != null)
                        hc.close();
                }
                catch(Exception e2)
                {
                    e2.printStackTrace();
                }
            }
            return res;
        }
    }
    

    and use it in this way

    public void getBytes()
        {
            ByteArrayOutputStream bos=null;
            try
            {
                bos=new ByteArrayOutputStream();
                InputStream fis=getClass().getResourceAsStream("/super.mp3");
                int ch;
                byte[] data=new byte[120];
                while((ch=fis.read(data,0,data.length))!=-1)
                {
                    bos.write(data,0,data.length);
                }
                Hashtable params=new Hashtable();
                //params.put("id_user","8474");
                params.put("id_user","8379");
                params.put("file1","audio.mp3");
                HttpMultipartRequest httpreq=new HttpMultipartRequest("http://api.upload.com/gStorage/uploadSong?", params,"file1","xpressMusic.mp3","audio/mpeg",bos.toByteArray());
                httpreq.send();
                bos.close();
                fis.close();
            }
            catch (Exception e) {
                System.out.println("Exception"+e);
            }
    

    Here, the key is contenttype, contentLength.you can get the info on it from the link above.

    thankx.

Maybe you are looking for