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 7072679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:50:17+00:00 2026-05-28T05:50:17+00:00

I have a webservice call that will return an image, now I want to

  • 0

I have a webservice call that will return an image, now I want to save this image to the filesystem in the server.

The problem is, I cannot make the webservice call from the server, as the webservice application runs on each user machine and a request is made to the service as http://localhost/get_image, which returns the image.

How do I save this image on the server?

  • 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-05-28T05:50:17+00:00Added an answer on May 28, 2026 at 5:50 am

    You can use HTML5 to load image using javascript and send base64 encoded response to sever where you can decode the response and write image to a file. Here is the approach

    1. Create a form with following html elements
      • canvas element: to get the image
      • text area: to store the base 64 encoded response and send response to server
    2. Ensure that the webservice response headers has “Access-Control-Allow-Origin: *” to allow cross origin resource sharing

    3. Jquery code

    var myCanvas = document.getElementById('canvasId');    
    var ctx = myCanvas.getContext('2d');    
    var img = new Image;    
    img.crossOrigin = 'anonymous';    
    img.src = "web service url which returns image";    
    img.onload = function(){
      console.log( img.width, img.height );
      // set canvas height and width to image height and width else only part of image will get created
      myCanvas.height = img.height;    
      myCanvas.width = img.width;    
      ctx.drawImage(img,0,0); // Or at whatever offset you like    
      var dataURL = myCanvas.toDataURL("image/png");    
      dataURL = dataURL.replace(/^data:image\/(png|jpg);base64,/, "");    
      $('#some_text_area_id').val(dataURL); // set the response in text area    
      $('#form_id').submit();   // submit the form
    };
    
    1. Server side – Decode the response using “base64” ruby library
    File.open('test.png',"wb") do |file|
      file.write(Base64.decode64(params[:text_area]))
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service that wish to call, and I want to pass
I have come up with the following code to call a webservice using client/server
I have an android application, that will call a SOAP web service for some
I have to call a third party webservice that expects and only accepts illegal
So I have a function that calls a web service which will return an
I have a little problem. I have developed a midlet application that call some
I have a webservice that I want to query for updates immediately after a
I have now something like this: public class Service1 : System.Web.Services.WebService { [WebMethod] public
I have a web service app, I have 1 web service call that could
I have a synchronous web service call that returns a message. I need to

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.