FTP Helper - Upload/Download remote files

I needed to be able to upload images in an app I’m making and figured that if I needed this functionality chances are there is at least one other person that might as well so I have posted it in the code exchange.

http://developer.anscamobile.com/code/ftp-helper

It’s all very simple and basic but if it saves someone 5 minutes then I figured it was worth it. [import]uid: 5833 topic_id: 5062 reply_id: 305062[/import]

hey thanks for the contribution, I wouldn’t have thought to do this with FTP. I would have written PHP or Python on the server than returns images in response to GET requests, but your way is simpler. [import]uid: 12108 topic_id: 5062 reply_id: 16613[/import]

That’s exactly what I was going to do (as that’s what I’ve been doing for text) before realising FTP might be possible and it turned out to be pretty easy. [import]uid: 5833 topic_id: 5062 reply_id: 16655[/import]

@GrahamRanson Thank for FTP-Helper.

How can overwrite file upload in remote FTP server?

What should I change in your code?

Waiting for your reply.

Admin6 [import]uid: 45018 topic_id: 5062 reply_id: 39312[/import]

If you upload a file with the same name as an existing file it should overwrite it. However you may need to change permissions on your server. Is this what you meant? [import]uid: 5833 topic_id: 5062 reply_id: 39314[/import]

hello, I have a question, how would I use this to allow a user to upload a file to my server, then only allow that user to retrieve it?

is that possible with your code?

Thanks, it would be a huge help if you could provide a solution :] [import]uid: 14940 topic_id: 5062 reply_id: 44883[/import]

All my code does is allow you to upload a file, protection of that file would be beyond the scope of it.

For ideas though, you could maybe upload it to a unique url that you could then give to that user, or put it in a folder and use basic authentication to protect it, or I’m sure other things. [import]uid: 5833 topic_id: 5062 reply_id: 44973[/import]

Nicely done, BAFTA.

… Don’t get too used to my praise :wink: [import]uid: 52491 topic_id: 5062 reply_id: 44979[/import]

@GrahamRanson That Makes sense, to upload it to a unique url that I could give to them, but any suggestions on how I could do that?

Thanks =] [import]uid: 14940 topic_id: 5062 reply_id: 44992[/import]

@peach - I’ll never get used to your praise. I’m still not even sure if you are using “BAFTA” as an insult or compliment :slight_smile:

@hiphopsded - I can’t remember exactly as I haven’t used the FTP stuff in a while, but you should be able to choose the name of the remote file for when you upload it, if not you could just rename the local file before uploading it. As for the name itself you could maybe use the current os.time() and maybe prefix it with a unique code specific for the user.

As for basic authentication - http://en.wikipedia.org/wiki/Basic_access_authentication - it is fairly trivial to do in from the end of the app ( loggin in ) as I have done it for a client app, however I am not a web developer so have never had to do it from the server end. [import]uid: 5833 topic_id: 5062 reply_id: 45198[/import]

Basically what I am wanting to do is allow a user to upload “settings1.db” located in the documents directory and have them download it to replace their current one if they want.

I get renaming the file to the current time, but I don’t know how I would call for that specific file again when it needs to be downloaded
Thanks [import]uid: 14940 topic_id: 5062 reply_id: 45213[/import]

You could either store the filename off somewhere on disk, or give the user a code they can enter which has been linked on your server to the unique url. [import]uid: 5833 topic_id: 5062 reply_id: 45222[/import]

very nice,thank u!!! [import]uid: 57346 topic_id: 5062 reply_id: 116938[/import]