rejetto forum

delete a file

Guest · 8 · 8467

0 Members and 1 Guest are viewing this topic.

lembas

  • Guest
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.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2068
    • View Profile
not necessary to use a form to do a delete programatically, use the macro {.delete| path/filename.}


lembas

  • Guest
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.



Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2068
    • View Profile
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


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
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.


Lembas

  • Guest
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?



Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2068
    • View Profile
something as:

<form>
<input type='text' name=selection' value=''>
<input type='submit' name='action' value='delete'>
</form>


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
more like this
<form method='post'>
<input type='hidden' name='selection' value='your-filename'>
<input type='submit' name='action' value='delete'>
</form>