Pass dynamic image of Titanium app (IOS/Android) to inside the Node.ACS

47 views
Skip to first unread message

maur...@gmail.com

unread,
Aug 25, 2014, 9:41:30 PM8/25/14
to node...@googlegroups.com
Someone know how pass an ImageView.image of titanium to Node.ACS... I am trying pass this image, but always of side of Node.ACS I have a "HTTP ERROR".

In the app.js I am using "app.use(express.bodyParser());" But when the requisition pass across of "req.files" the error happen. =S

Wei Kong

unread,
Aug 28, 2014, 9:04:02 PM8/28/14
to node...@googlegroups.com
Can you please provide more details? We tried internally and it worked fine

$ cat app.js 

// initialize app

function start(app, express) {

app.use(express.favicon(__dirname + '/public/images/favicon.ico')); //set favicon

app.use(express.bodyParser());

}


// release resources

function stop() {

}


$ cat controllers/application.js 


function index(req, res) {

    console.log('paul');

    console.log(req.files);

    res.render('index', {

        title: 'Welcome to Node.ACS!'

    });

}


$ curl -F "file1=@config.json" http://localhost:8080

<!DOCTYPE html>

<html>

  <head>

<title>Welcome to Node.ACS!</title>

    <link rel='stylesheet' href='/css/style.css' />

  </head>

  <body>

  <h2>Node.ACS</h2>

    <p>Welcome to Node.ACS!</p>

  </body>

</html>


$ acs run

ACS: Appcelerator Cloud Services Command-Line Interface, version 1.0.16

Copyright (c) 2012-2014, Appcelerator, Inc.  All Rights Reserved.


[DEBUG] dependency => async@>=0.9.0

[INFO]  Installing dependencies...

[INFO]  Dependencies installed.

[INFO]  socket.io started

[INFO]  ACS started on port 8080

[INFO]  paul

[INFO]  { file1: 

   { domain: null,

     _events: {},

     _maxListeners: 10,

     size: 266,

     path: '/tmp/2998aea0fa6fd67c548b38cf16905faa',

     name: 'config.json',

     type: 'application/octet-stream',

     hash: false,

     lastModifiedDate: Tue Aug 26 2014 09:46:57 GMT+0800 (CST),

     _writeStream: 

      { _writableState: [Object],

        writable: true,

        domain: null,

        _events: {},

        _maxListeners: 10,

        path: '/tmp/2998aea0fa6fd67c548b38cf16905faa',

        fd: null,

        flags: 'w',

        mode: 438,

        start: undefined,

        pos: undefined,

        bytesWritten: 266,

        closed: true },

     length: [Getter],

     filename: [Getter],

     mime: [Getter] } }




On Mon, Aug 25, 2014 at 6:41 PM, <maur...@gmail.com> wrote:
Someone know  how pass an ImageView.image of titanium to Node.ACS...   I am trying pass this image, but always of side of Node.ACS  I have a "HTTP ERROR".

In the app.js I am using  "app.use(express.bodyParser());"  But when the requisition pass across  of "req.files" the error happen. =S

--
You received this message because you are subscribed to the Google Groups "Node.ACS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-acs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

maur...@gmail.com

unread,
Aug 30, 2014, 12:07:09 PM8/30/14
to node...@googlegroups.com, maur...@gmail.com
Em segunda-feira, 25 de agosto de 2014 22h41min30s UTC-3, maur...@gmail.com escreveu:
> Someone know how pass an ImageView.image of titanium to Node.ACS... I am trying pass this image, but always of side of Node.ACS I have a "HTTP ERROR".
>
> In the app.js I am using "app.use(express.bodyParser());" But when the requisition pass across of "req.files" the error happen. =S

Hi.
Now I see that my problem is happening at the Titanium Mobile side.
At the Ti Studio I have created a ACS webservice "PostPhoto", but I don't know how to pass the ImageView.image to the webservice method, so this way the Node.ACS understand that it is a File Upload and put the content under req.files.

Reply all
Reply to author
Forward
0 new messages