Is there a way to get a file from a certain ftp/http site from within an application?
Printable View
Is there a way to get a file from a certain ftp/http site from within an application?
There is no HTTP stack APIs in the Symbian platform, if developers want HTTP, they have to implement it themselves. There are some stuff about FTP, but there is no documentation about using this in the SDK Help, anyway FTP functionalities can be found from the header file comftp.h from the Crystal V6.0 SDKs.
Some unfinished code as an outline is presented in the lines below.
You'll need to create an instance of CFileTransferManager and then
CreateProtocolByNameL to create an instance of CFileTransfer.
Here's some code to do the actual send of a set of files:
void sendSomeFiles(CFileTransfer& aTransfer,CPtrCArray& aFilelist)
{
CDesCArray* uploadnames= new (ELeave) CDesCArrayFlat(4);
TFileTransferCapabilities caps=aTransfer.Capabilities();
//uploadnames->Reset();
TInt ptr=0;
TInt count=aFilelist.Count();
if (count==0)
return;
while(ptr<count)
{
if (caps.iHandleMultipleUploads)
{
uploadnames->AppendL(aFilelist[ptr]);
}
else if (ptr==0)
uploadnames->AppendL(aFilelist[ptr]);
ptr++;
}
//uploadnames->AppendL(_L("test.scr"));
test.Next(_L("Sending files "));
test.Printf(_L("Start the receiver program to be tested and press any key when
ready.."));
test.Getch();
test.Printf(_L("\n"));
CTransferTracker* tracker=new(ELeave) CTransferTracker;
TCallBack callBackEnd(FuncCallbackEnd);
aTransfer.UpLoad(callBackEnd,KCommsUploadDirectory,*uploadnames,tracker);
TheScheduler->Start();
TInt status=aTransfer.iStatus.Int();
test(status==KErrNone | status==KErrCancel);
delete(tracker);
}
Semi colons are showing up as smiley faces (Annoying isn't it) That problem should be fixed shortly.
you need to tell people on the post reply page that they can use [code]code[/code] tags. That is the word "code" in between []. Then the word "/code" inbetween []. ie. the same ones from phpBB. Makes code alot easier to read, keeps all the tabbing etc.
Dalore
OSXDev,
I searching desesparatly how to implement a small ftp (Series 60) in my app and I have tried your stuff of code but I'm unable to link it, which library must I use for the CFileTransfer and CTransferTracker
Thanks in advance,
Dominique HUGO
[email]d.hugo@sage.be[/email]
No I am having the same problem as Jeepy:
I downloaded a Crystal V6.0 SDK, which contains the comftp.h.
But which library must i use to link successfully ? Has anybody actually used this comftp.h swith success for 3650 devices ?
rsaccon,
I have found the solution for the libraries *BUT* the problem doesn't seem to come from there, in fact, the Series 60 don't have the necessary dll associated with comftp.h (for myself ...)
thanks to Nokia !!
Dominique HUGO
[email]d.hugo@sage.be[/email]
I use this code to upload the contents of a file in an HTTP POST. Maybe it can help you?
[url]http://discussion.forum.nokia.com/forum/showthread.php?s=&postid=62798#post62798[/url]
Thanks oledocmeth, I'm going to try it ....
Dominique HUGO
[url]www.gosymbian.com[/url]