How to attach a file to upload with network.request?

Hello,

The example below is from the documentation for network.request showing how to post to a url. Can someone show me by code how to change it to upload a file from the temporary directory?

Thanks!!

local function networkListener( event )  
 if ( event.isError ) then  
 print( "Network error!")  
 else  
 print ( "RESPONSE: " .. event.response )  
 end  
end  
  
postData = "color=red&size=small"  
  
local params = {}  
params.body = postData  
  
network.request( "http://127.0.0.1/formhandler.php", "POST", networkListener, params)  

[import]uid: 184193 topic_id: 36092 reply_id: 336092[/import]

Not sure, but would this help?

http://developer.coronalabs.com/code/upload-binary-corona-php-script

They’re messing with the temporary directory…

Hope it helps!

-Mario [import]uid: 11636 topic_id: 36092 reply_id: 143357[/import]

Thanks, I looked at it and I’ll going to try using that code tonight. I am actually trying to upload a sound file that I record in the app. Hopefully this will work.

Warren
[import]uid: 184193 topic_id: 36092 reply_id: 143358[/import]

Rad! Let everyone know how it turns out!! That’d be good to know!!

-Mario [import]uid: 11636 topic_id: 36092 reply_id: 143359[/import]

Not sure, but would this help?

http://developer.coronalabs.com/code/upload-binary-corona-php-script

They’re messing with the temporary directory…

Hope it helps!

-Mario [import]uid: 11636 topic_id: 36092 reply_id: 143357[/import]

Thanks, I looked at it and I’ll going to try using that code tonight. I am actually trying to upload a sound file that I record in the app. Hopefully this will work.

Warren
[import]uid: 184193 topic_id: 36092 reply_id: 143358[/import]

Rad! Let everyone know how it turns out!! That’d be good to know!!

-Mario [import]uid: 11636 topic_id: 36092 reply_id: 143359[/import]

Not sure, but would this help?

http://developer.coronalabs.com/code/upload-binary-corona-php-script

They’re messing with the temporary directory…

Hope it helps!

-Mario [import]uid: 11636 topic_id: 36092 reply_id: 143357[/import]

Thanks, I looked at it and I’ll going to try using that code tonight. I am actually trying to upload a sound file that I record in the app. Hopefully this will work.

Warren
[import]uid: 184193 topic_id: 36092 reply_id: 143358[/import]

Rad! Let everyone know how it turns out!! That’d be good to know!!

-Mario [import]uid: 11636 topic_id: 36092 reply_id: 143359[/import]

Not sure, but would this help?

http://developer.coronalabs.com/code/upload-binary-corona-php-script

They’re messing with the temporary directory…

Hope it helps!

-Mario [import]uid: 11636 topic_id: 36092 reply_id: 143357[/import]

Thanks, I looked at it and I’ll going to try using that code tonight. I am actually trying to upload a sound file that I record in the app. Hopefully this will work.

Warren
[import]uid: 184193 topic_id: 36092 reply_id: 143358[/import]

Rad! Let everyone know how it turns out!! That’d be good to know!!

-Mario [import]uid: 11636 topic_id: 36092 reply_id: 143359[/import]