Hello,
I have a question, in Corona SDK, can I upload pdf files and if so, how can I select them from my device, that is, give me the option and possibility of uploading a file?
Hello,
I have a question, in Corona SDK, can I upload pdf files and if so, how can I select them from my device, that is, give me the option and possibility of uploading a file?
Oh come on… just google it!
Searching for “corona sdk upload” gives you a direct link to documentation, and documentation is your friend btw, https://docs.coronalabs.com/api/library/network/upload.html
The same search also provides a link to a tutorial on Corona’s blog.
Really, make some effort!
Thanks for the quick reply. but what I need is that by pressing a button I can select a file that is on my device. I know how to send it to the server, what I do not know is how to open and choose a document that is on my cell phone, something like what media.source does. Thank you
This code worked for me for selecting images from photo library … not sure about pdf or other files
local function onComplete( event ) local photo = event.target --Code to upload to server end local function selectImg\_Tap() if media.hasSource( media.PhotoLibrary ) then media.selectPhoto( { mediaSource=media.PhotoLibrary, listener=onComplete } ) else native.showAlert( "Corona", "This device does not have a photo library.", { "OK" } ) end end local selectImg = display.newImage("images/select.png") selectImg.x=display.contentCenterX selectImg.y=display.contentCenterY selectImg:addEventListener("tap",selectImg\_Tap)
Oh come on… just google it!
Searching for “corona sdk upload” gives you a direct link to documentation, and documentation is your friend btw, https://docs.coronalabs.com/api/library/network/upload.html
The same search also provides a link to a tutorial on Corona’s blog.
Really, make some effort!
Thanks for the quick reply. but what I need is that by pressing a button I can select a file that is on my device. I know how to send it to the server, what I do not know is how to open and choose a document that is on my cell phone, something like what media.source does. Thank you
This code worked for me for selecting images from photo library … not sure about pdf or other files
local function onComplete( event ) local photo = event.target --Code to upload to server end local function selectImg\_Tap() if media.hasSource( media.PhotoLibrary ) then media.selectPhoto( { mediaSource=media.PhotoLibrary, listener=onComplete } ) else native.showAlert( "Corona", "This device does not have a photo library.", { "OK" } ) end end local selectImg = display.newImage("images/select.png") selectImg.x=display.contentCenterX selectImg.y=display.contentCenterY selectImg:addEventListener("tap",selectImg\_Tap)