Overwriting a file on a server
Graham Samuel
livfoss at mac.com
Tue Mar 6 10:33:29 EST 2018
More wisdom from Charles, sincere thanks!
However, I don’t seem to be able to mimic what my FTP software (Transmit on the Mac, or FileZilla) can do, which is to easily delete a file on a server - the file in question is part of a web site hosted by DreamHost. I just want to use the URL functionality to do this, as discussed in my conversation below, but I always get 405 (http) or 530 (ftp). I have a vague suspicion that I should be transmitting my credentials to the server, which of course I did when I set up my FTP client, but I have absolutely no idea how to do this.
Many members of this list must have mucked around with files on a server - can someone point me to a tutorial on all this?
TIA
Graham
> On 6 Mar 2018, at 08:59, Charles Warwick via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> 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
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list