Upload Video per FTP

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
csoca
Posts: 4
Joined: Fri Jan 18, 2013 7:39 pm

Upload Video per FTP

Post by csoca » Fri Jan 18, 2013 8:08 pm

Hi,

I am trying to upload a video to a ftp-server. Uploading an image is no problem. With the code below I also can upload a file, but not the video. The content of the file is only the path, if I open the file with an editor.
For pick the video I have an external av from mergext
the problem is the line: put tFileForUpload into URL theURL - only the filepath is in the uploaded file
here I need binary files ? but how to "convert"?

thanks for help
Chris


Code: ***********************************************
on touchEnd pId
mobGUIUntouch the long id of me

local tFileForUpload, tFileName
put mergAVPick("library","medium",180) into tFileForUpload
set the itemdel to "/"
put "ftp://user:pwd@ftpserver/myvideo1.mov" into theURL

put tFileForUpload into URL theURL !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


if the result is not empty then
answer the result
hide group "progress"
end if

end touchEnd

csoca
Posts: 4
Joined: Fri Jan 18, 2013 7:39 pm

Re: Upload Video per FTP

Post by csoca » Fri Jan 18, 2013 8:18 pm

Hi,
I found a first solution:

I replace: put tFileForUpload into URL theURL

to:
put tFileForUpload into theFilePath
open file theFilepath for binary read
read from file theFilePath until end
put it into theBinaryData
close file theFilePath
put theBinaryData into URL theURL

the other question: is this solution good for large files 30-70 MB?
thanks
Chris

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Upload Video per FTP

Post by shaosean » Mon Jan 21, 2013 10:41 am

You would be better off doing a loop over the data and upload it in chunks so as not to tie up your GUI (remember Rev is single threaded).. By doing the "read until EOF" you are loading the whole file in to memory first and then sending it.. When doing your loop, do not use a repeat structure, but a recursive send loop..

csoca
Posts: 4
Joined: Fri Jan 18, 2013 7:39 pm

Re: Upload Video per FTP

Post by csoca » Wed Jan 23, 2013 3:27 pm

thanks for your answer and suggestion. :D
Do you have a short code example or link to one of a "recursive send loop"?

Post Reply