I have succeeded in uploading pictures to the server using the code that Rob suggested
https://forums.coronalabs.com/topic/70663-networkupload-and-matching-php-code/
Now I am trying to the same with a video that has been captured with media.captureVideo
I am using the example found under media.captureVideo()
https://docs.coronalabs.com/api/library/media/captureVideo.html
and just change the listener to send the URL of the video and what I think would be the directory
local function onComplete( event ) if event.completed then -- media.playVideo( event.url, media.RemoteSource, true, onVideoComplete ) print( "event.duration: "..event.duration ) print( "event.fileSize: "..event.fileSize ) print("event.url: "..event.url) theVideoFile = event.url theDirectory = media.RemoteSource uploadVideo(theVideoFile,theDirectory,"testvideo.mov") end end
and in the uploadVideo I basically send this command:
local contentType = "multipart/form-data" network.upload( theUploadString , method, uploadListener, theVideoFile, theDirectory, contentType )
However the uploadListener never triggers so I am guessing that either it is not possible (this way) to upload a video or I need to have another value for “theDirectory”.
I have also tried to upload without having a value for the directory.
local function uploadListener( event ) if ( event.isError ) then print( "Network Error." ) else if ( event.phase == "began" ) then print( "Upload started" ) elseif ( event.phase == "progress" ) then print( "Uploading... bytes transferred ", event.bytesTransferred ) elseif ( event.phase == "ended" ) then print( "Upload ended..." ) print( "Status:", event.status ) print( "Response:", event.response ) end end end
Are there anyone who has tried to solve this problem or could give me a hint in the right direction ?