Results 1 to 4 of 4

Thread: [SOLVED] Adding uploaded document to mail

  1. #1
    Join Date
    Aug 2009
    Posts
    10
    Rep Power
    6

    Default [SOLVED] Adding uploaded document to mail

    Hello,

    My zimlet has JS and JSP
    1) in compose view, JS is calling JSP with a file path(local drive)
    2) JSP uploading the file to server (/service/upload?fmt=raw)
    and it returns as:

    200,'null','013afbb0-7c77-494d-b078-b6029d784abd:30d2388f-9d18-42fc-abdd-c414c4b86968'

    here,
    ------
    httpStatus = 200
    client_token = null
    server_token = '013afbb0-7c77-494d-b078-b6029d784abd:30d2388f-9d18-42fc-abdd-c414c4b86968'

    Now i have to add this uploaded document to my mail. Here i am confused what to do.

    i used in js as below:
    -----------------------
    msg.setSubject("Message subject test");
    msg.addAttachmentId(server_token);

    on sendMsg i got below error:
    --------------------------------
    method: SendMsgRequest
    msg: upload not found: '8fdb85f4-d9f3-4d96-a40c-966ef55ddebc:13c8f7cf-b8c0-4955-8663-a07cafe7044e'
    code: mail.NO_SUCH_UPLOAD
    detail: soap:Sender
    trace: btpool0-0:1251799378674:8620ef4fcc63768f
    request:

    Please suggest what to do.

  2. #2
    Join Date
    Aug 2009
    Posts
    10
    Rep Power
    6

    Default

    I have solved it and the issue was that server_token returned from server as prefixed ans suffixed with single quote(').

    I removed and followed the below code:

  3. #3
    Join Date
    May 2009
    Posts
    48
    Rep Power
    6

    Default

    Quote Originally Posted by pramodkrjsr View Post
    I have solved it and the issue was that server_token returned from server as prefixed ans suffixed with single quote(').

    I removed and followed the below code:
    Hi
    am also trying out a zimlet where il be uploading some document to another server from my local hard disk .

    But presently what i am doing is in 2 Steps.
    1> Uploading the doc to zimbra Temp folder(of my own)
    2>Uploading the Temp File to the Other Server .

    My Question is how to directly do the same from the Zimlet without any Temp File Step .

  4. #4
    Join Date
    Aug 2009
    Posts
    10
    Rep Power
    6

    Default

    Hello,

    As per my understanding:
    You are trying to upload a local file (i.e. c:\temp\my.txt) to another server (ABC.com).


    NOw i am sure your another server must have some servlet to accept uploaded files:

    Now please follow below steps:

    1) from zimlet JS, accept the local file path (via some dialog)
    2) call a JSP by passing this file path
    3) now make a PostMethod call to your server (using commons-httpclient)

    JSP Sample:
    =========
    PostMethod filePost = new PostMethod("http://www.abc.com/upload");
    filePost.getParams().setBooleanParameter(HttpMetho dParams.USE_EXPECT_CONTINUE, false);

    Part[] parts = {new FilePart(filename,filename,new File(filepath))};
    filePost.setRequestEntity(new MultipartRequestEntity(parts, filePost.getParams()));

    HttpClient client = new HttpClient();
    client.getHttpConnectionManager().getParams().setC onnectionTimeout(5000);

    // Perform the request
    int status = client.executeMethod(filePost);

    // Use response to generate data for the zimlet
    if (status == HttpStatus.SC_OK) {
    String[] serverResponseArr = filePost.getResponseBodyAsString().split(",");
    } else {
    out.println("Error: " + HttpStatus.getStatusText(status));
    }

Similar Threads

  1. Mail deferred with Connection timed out
    By Miklos Kalman in forum Administrators
    Replies: 7
    Last Post: 11-17-2012, 05:11 AM
  2. Replies: 7
    Last Post: 02-03-2011, 06:01 AM
  3. Problem with Postfix and MTA
    By ZMilton in forum Administrators
    Replies: 16
    Last Post: 04-16-2008, 06:47 AM
  4. Replies: 2
    Last Post: 02-12-2008, 10:55 AM
  5. Initializing ldap...FAILED (256)
    By CVD in forum Installation
    Replies: 17
    Last Post: 03-10-2006, 08:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •