Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Upload File
Started by jjrey95 Jul 19 2019 08:02 AM

3 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jjrey95

[GLOBAL: userInfoPane.html]
jjrey95
  • Observer

  • 29 posts
  • Corona SDK

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?



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,020 posts
  • Corona SDK

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! :D



[TOPIC: post.html]
#3

jjrey95

[GLOBAL: userInfoPane.html]
jjrey95
  • Observer

  • 29 posts
  • Corona SDK

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



[TOPIC: post.html]
#4

kakula

[GLOBAL: userInfoPane.html]
kakula
  • Contributor

  • 106 posts
  • Corona SDK

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)




[topic_controls]
[/topic_controls]