Uploading video

Hey all,

I’ve got the basic example of uploading photos via the post:  

http://coronalabs.com/blog/2014/02/25/tutorial-uploading-files-demystified/

working fine. 

How do I upload video, i.e., what form does the network.upload command expect when selecting video? In the photo example, we’re copying a photo to the Tmp directory, but for video that’s hardly efficient.

I’ve now got the sample app from that example using the media.selectVideo

local function UploadVideo(event) debugText = "" outputText.anchorY = 0 outputText.x = 300 outputText.y = 0 -- Sepcify the URL of the PHP script to upload to. Do this on your own server. -- Also define the method as "PUT". local url = "http://www.iswdev.com/stuff/upload.php" local method = "PUT" -- Set some reasonable parameters for the upload process: local params = { timeout = 60, progress = true, bodyType = "binary" } -- Specify what file to upload and where to upload it from. -- Also, set the MIME type of the file so that the server knows what to expect. local filename = event.url -- The below works fine when uploading a video to the webhost manually -- when the video is in the system.resources folder local contentType = "mp4" --another option is "text/plain" local headers = {} headers.filename = filename params.headers = headers network.upload( url , method, uploadListener, params, filename, baseDirectory, contentType ) end function onCompletePickVideo( event ) if event.completed then -- media.playVideo( event.url, media.RemoteSource, true ) UploadVideo(event) end end

Where I’m stuck on is the “baseDirectory” expectation. Since the event.URL contains the sandbox location and filename combined, I don’t have them both separately and therefore don’t know where to put the filename and the URL as outline in the photo example.

Backend hosting issues and difficulty aside, I’m more interested in the Corona implementation of this feature. I mean, I always could go and use the video capture feature, but what happens if I have a great video already in my saved photos and want to upload it from there? I mean, some of those videos are going to be one-in-a-million right!? Like the one where my friend falls through a shed roof on some abandoned property and gets stuck there! Although…that’s neither here nor there…

Appreciate the help folks!

-Mario

Hello Mario, have you managed to get this working? We’re currently having this issue too.

Hello Mario, have you managed to get this working? We’re currently having this issue too.