Downloading an image in corona is really easy.
Check out the example.

	module(..., package.seeall)

	_W = display.contentWidth;
	_H = display.contentHeight;

	function new()
		local grp = display.newGroup();
		local myImage;

		local function networkListener( event )
			if ( event.isError ) then
					print ( "Network error - download failed" )
					myImage = display.newImage( "helloCopy.png", system.TemporaryDirectory, 60, 40 )
					myImage.alpha = 0 myImage, { alpha = 1.0 } )


			print ( "RESPONSE: " .. event.response )
	end "", "GET", networkListener, "helloCopy.png", system.TemporaryDirectory )

	return grp;


Check the console to see where the downloaded file is saved.

Download the complete source code from here.


Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.