Invalid Parameter: First argument to network.request() should be a URL string?

Hi, recently i have been posting questions regarding displaying of image from url and had reached the last part of which is just displaying the image, but encountered this error:

“Invalid Parameter: First argument to network.request() should be a URL string.”

Which is sort of confusing to me, here is my code:

local function networkListener( event ) if( event.isError) then print( "Network error - download failed" ) else myImage = display.newImage( "image.png" ,system.TemporaryDirectory, (display.contentWidth / 2), (display.contentHeight \* 0.5) ) myImage.alpha = 0 transition.to(myImage, { alpha = 1.0 } ) end sceneGroup:insert(myImage) local dd = os.date( "\*t" ) dd.hour = math.floor( dd.hour / 1 ) local ddnum = tonumber( dd ) local filename = os.date( "%Y%m%H%M", ddnum ) print( filename ) local url = "http://domain.com/data/Image/"..filename.."\_0.png" end network.download( url, "GET", networkListener, "image.png", system.TemporaryDirectory ) 

but when I replaced the url with the exact url, I would get this error:

“attempt to concatenate global ‘filename’ (a nil value)”

Anyone has suggestions?

Hi w0shi21

You defined url variable inside the networkListener function.

So when you called network.request its value is nil that why “Invalid Parameter: First argument to network.request() should be a URL string.” error is occurs.

Best Regards,

Team, SP Technolab

www.sptechnolab.com

Hi w0shi21

You defined url variable inside the networkListener function.

So when you called network.request its value is nil that why “Invalid Parameter: First argument to network.request() should be a URL string.” error is occurs.

Best Regards,

Team, SP Technolab

www.sptechnolab.com