Overwriting a file on a server

Charles Warwick charles at techstrategies.com.au
Tue Mar 6 02:59:34 EST 2018


Hi Graham,

> On 5 Mar 2018, at 11:04 pm, Graham Samuel via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Another dumb question, I’m afraid. The dictionary says I can do
> 
>  put tdata into URL [some url]
> 
> well, I want to put a file on my server (in this example, it’s a text file) to replace one of the same name. If I just try to steamroller it by ignoring the existing file, I get a ‘405’ error (forbidden method, I think). If I use an FTP client like Transmit, I get a warning about overwriting the file and a manual override.
> 
> How can I grow my own, by detecting the existing file and then overwriting it anyway? Should I delete the existing file as a separate operation? How can I be sure I have enough permission to do so?

You can use ‘delete URL’ to delete an FTP file.  If the result is not empty, then it failed to delete it.

You could always try the ‘put’ first, and if you get a 405 error, try the ‘delete’.  If the delete is successful, you can ‘put’ again.  If the delete is unsuccessful, advise the user.

Cheers,

Charles




More information about the use-livecode mailing list