rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: lembas on June 16, 2009, 10:18:37 PM

Title: delete a file
Post by: lembas on June 16, 2009, 10:18:37 PM
What is the exact code of the "form to submit" to delete a file? I think, there will be the name of the file to delete somewhere in the form.

My aim is to delete a file on an HFS server programatically. i.e. by submiting a form. I tried to analyze the template source code but could not figure it out. There is one real folder. I can delete the file using the browser.
Title: Re: delete a file
Post by: Mars on June 17, 2009, 05:21:21 PM
not necessary to use a form to do a delete programatically, use the macro {.delete| path/filename.}
Title: Re: delete a file
Post by: lembas on June 17, 2009, 09:53:51 PM
Sorry but i do not know what a macro is. I have a desktop application and I want to know what to send to hfs server to delete a file without using any browser. Is it possible? I am using HFS version 2.42.

Title: Re: delete a file
Post by: Mars on June 17, 2009, 10:07:47 PM
The macro are similar to the language PHP, but are specific to HFS, go through the wiki of rejetto to familiarize you with those and define exactly what you intend to make ;)

http://www.rejetto.com/forum/index.php?topic=5542.0
Title: Re: delete a file
Post by: rejetto on June 19, 2009, 02:56:47 PM
welcome lembas.
i got what you meant.
you must issue a POST request, and the url must be the folder containing the file.
the posted data must be
action: delete
selection: file1
selection: file2
selection: file3

as you can see, the name selection is repeated for every file.
i think you can also use / as URL and specify the whole path to the file.
Title: Re: delete a file
Post by: Lembas on December 04, 2009, 10:23:47 AM
sorry for replying so late. I think this is what you mean

<form><input type='submit' name='action' value='delete'></form>
{.if|{.?action = delete.}|{:
    {.delete|filename.}
:}.}

but how can i tell the server the filename?

Title: Re: delete a file
Post by: Mars on December 04, 2009, 07:45:14 PM
something as:

<form>
<input type='text' name=selection' value=''>
<input type='submit' name='action' value='delete'>
</form>
Title: Re: delete a file
Post by: rejetto on December 08, 2009, 12:22:46 PM
more like this
<form method='post'>
<input type='hidden' name='selection' value='your-filename'>
<input type='submit' name='action' value='delete'>
</form>