Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9316869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:44:04+00:00 2026-06-19T02:44:04+00:00

I am trying to POST an image to my grails application and I’m not

  • 0

I am trying to POST an image to my grails application and I’m not having much luck.

My titanium code is:

function upload(){  
    var xhr = Titanium.Network.createHTTPClient();
    xhr.onerror = function(e){
        Ti.API.info(picMedia + " : " +message.value);
        Ti.API.info('IN ERROR ' + e.error);
        alert('Sorry, we could not upload your photo! Please try again.');
    };
    xhr.onload = function(){
        Ti.API.info('IN ONLOAD ' + this.status + ' readyState ' + this.readyState);
    };
    xhr.onsendstream = function(e){
        Ti.API.info('ONSENDSTREAM - PROGRESS: ' + e.progress);
    };
    // open the client
    xhr.open('POST', 'http://localhost:8080/FYP/Profile/appUploader'); 
    // send the data
    xhr.send({
        media: picMedia,
        message: message.value,
    });

}

My grails code is as follows:

   def appUploader(){

            println "MEDAI PARAMS: " + params.media
          def f = request.getFile('media') ;
             println "HERE: " + f
           if (request.getFile(params.media).getOriginalFilename()) {
               println     "FROM APP: "      +    request.getFile('myFile').getOriginalFilename()


               return
           }
    }

Im getting error from the mobile app and error on the “if” line in the web app.
What am i doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T02:44:05+00:00Added an answer on June 19, 2026 at 2:44 am

    we had the same problem in one of our apps. The difficulty is that titanium is not really able to handle binary files in that case.

    We did the following:

    • create base64 encoded string of the image on client side
    • post this string to the backend
    • decode base64 to image again

    We analyzed a lot of network traffic and in most cases titanium tries to send the file but due to javascript its alway converted into some kind of ascii and this is not usable by the server side.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to post JSON data to Spring controller.. Not working at all JSP Code:
I am trying to post image on facebook but not successful yet, my codes
Is it possible to bypass hotlink image protection? i'm not trying to post it
I am trying to post an image to a Facebook album using a form
I am trying to receive the url image and post the image into base64
I'm trying to convert the following CURL: curl -X POST \ -H Content-Type: image/jpeg
I'm trying to POST a PayPal or GoogleCheckout buy now button from the code
I am trying to post an image to Cheezburger.com with a PHP script, and
i'm trying to post an image to my users's facebook wall once they hit
Hi I am trying to post an image but I must be missing something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.