rejetto forum

move files after upload on location that is set with selected the listbox

gogi1000 · 21 · 10128

0 Members and 1 Guest are viewing this topic.

Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
i have listbox in upload page. i want that after upload files on server i move those files on location that is set selected element in list box.

my upload page is

<code>[upload]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
{.$copyright.}
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
   <title>{.!lv_upload.}</title>
   <link rel="shortcut icon" href="/favicon.ico"/>
   <script type="text/javascript" src="/template/rawr_default/code/rawr_main.js"></script>
   <script type="text/javascript">
      var theme="{.!theme.}";
      var mod_statistics="{.!mod_statistics.}";
      //Language Strings
      var lv_hideTitle="{.!lv_hideTitle.}";
      var lv_showTitle="{.!lv_showTitle.}";
      
       function RegainFocus() {

      if((document.getElementById("lista").value).length == 0) {

        document.getElementById("kontrola").style.display = 'none';

      }
     else
     {
       document.getElementById("kontrola").style.display = 'block';
     }

    }     
   </script>
   <link rel="stylesheet" type="text/css" href="/template/{.!theme.}/code/{.!theme.}_main.css"/>
   <noscript><style type="text/css">.hide{display:none}#f1,#f2,#f3,#f4,#f5,#f6,#f7,#f8,#f9{display:block}</style></noscript>
   <!--[if lte IE 6]>
      <style type="text/css">#mainInner{width:980px}</style>
      <noscript><style type="text/css">#mainInner{width:100%}</style></noscript>
   <![endif]-->
</head>
<body>
<div id="mainOuter">
<div id="mainInner"><div id="mainInner1"><div id="mainInner2"><div id="mainInner3">
   <div id="header">
      <div>
         <div id="bCrumbs">{.breadcrumbs|{:<a href="%bread-url%">{.or|%bread-name%|{.!lv_home.}.}/</a>:}.}</div>
      </div>
   </div>
   <div id="content">
      <div id="navbar">
         <noscript>
            <div class="biggerBtn"><a href="~upload" target="_top"><span>{.!lv_closeTransfers.}</span></a></div>
         </noscript>
         <div class="biggerBtn">
            <a href="javascript:void(0);" onclick="window.open('/~progress','{.!lv_transfers.}','width=300,height=500,left=100,top=100,scrollbars=1,resizable=1');" class="hide"><span>{.!lv_openTransfers.}</span></a>
            <noscript><a href="~upload+progress" target="_top"><span>{.!lv_openTransfers.}</span></a></noscript>
         </div>
         {.if|{.{.!btn_back.}=on.}|<div id="backBtn"><a href="%encoded-folder%" target="_parent"><span>{.!lv_back.}</span></a></div>.}
      </div>
      <table cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
         <td width="100%" valign="top" id="tableCol">
            %folder-comment%
            <div class="contModule">
               <div class="contHeading">
{.if|{.{.!mod_statistics.}=on.}|
                  <span class="hide">
                     <a href="javascript:pinModule('moduleCol');" id="moduleCol_Link" title="{.!lv_hideTitle.}"><img src="/template/{.!theme.}/images/show.gif" align="top" alt=""/></a>
                  </span>
.}
                  &nbsp;
               </div>
               <div class="contContent" align="center" >
               
                  <form action="%encoded-folder%" id="kontrola" hidden name="upfrm" target="_parent" method="post" enctype="multipart/form-data"  onsubmit="disableBtns();">
                     <input class="uploadInput"  name="upbtn" value="{.!lv_upload.}" type="submit"/>
                     <input class="uploadInput hide"  name="more" onclick="addInput();" value="{.!lv_addInput.}" type="button"/><br/>
                     <input type="file" name="fileupload1"  size="40"/>
                     <input id="f1" type="file" name="fileupload2" size="40"/>
                     <input id="f2" type="file" name="fileupload3" size="40"/>
                     <input id="f3" type="file" name="fileupload4" size="40"/>
                     <input id="f4" type="file" name="fileupload5" size="40"/>
                     <input id="f5" type="file" name="fileupload6" size="40"/>
                     <input id="f6" type="file" name="fileupload7" size="40"/>
                     <input id="f7" type="file" name="fileupload8" size="40"/>
                     <input id="f8" type="file" name="fileupload9" size="40"/>
                     <input id="f9" type="file" name="fileupload10" size="40"/>
                  </form>
                  
               </div>
            </div>
         </td>
           <td width="100%" valign="top" id="tableCol">
         <div class="contModule">
               <div class="contHeading">
               Изаберите тип документа
                     </div>
               <div class="contContent" align="center">
         <form>
         <select id="lista" name="metodologija" onclick="javascript:RegainFocus();">
         <option value="" selected="selected" ></option>
  <option value="statut">statut</option>
  <option value="bilans stanja">bilans stanja</option>
  <option value="racunovodstvena dokumentacija">racunovodstvena dokumentacija</option>
  <option value="javne nabavke">javne nabavke</option>
</select>
</form>
</div></div>
</td>
      </tr>
      </table>
   </div>
   <div id="footer">
      <br/>
      
   </div>
</div></div></div></div>
</div>
<script type="text/javascript">pageLoad()</script>
</body>
</html>
</code>

how i resolve this problem that i use macro or javascript?can you help me?


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
i tryed with this code in template but nothing

 <option value="statut" onclick="{.set|statut|C:\Users\gljubic.DRI\Desktop\httpserver\statut\.}">statut</option>
  <option value="bilans stanja" onclick="{.set|bilans stanja|%item-folder%/bilans stanja/.}">bilans stanja</option>
  <option value="racunovodstvena dokumentacija" onclick="{.set|racunovodstvena dokumentacija|%item-folder%/racunovodstvena dokumentacija/.}">racunovodstvena dokumentacija</option>
  <option value="javne nabavke" onclick="{.set|javne nabavke|%item-folder%/javne nabavke/.}">javne nabavke</option>
</select>
</form>
</div></div>
</td>
      </tr>
      </table>
   </div>
   <div id="footer">
      <br/>
      
   </div>
</div></div></div></div>
</div>
<script type="text/javascript">pageLoad()</script>
</body>
</html>
[upload completed]
{.if|{.exists|{.call|statut.}.}|{.move|%item-resource%|C:\Users\gljubic.DRI\Desktop\httpserver\statut.}.}

can you help me?


Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 911
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
i would have you review another forum thread:
http://www.rejetto.com/forum/html-templates/file-upload-with-drag-and-drop/

if you edit the template from that topic, you will see how the upload gets files moved, or you might switch to that template.

it looks to be a macro code error in your template/ html code...
Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
i m begginer in macros for hfs http server. i have some questions, can i create section [upload completed] in template and this section i type code or i must set this section in hfs.events file? how i pass to value of listbox selected element to hfs macro variable?


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
i'm found solution using script events with variable but i don't know how get value of variable. the variable have path where i want move file but i don't know how use this path in command move  {.move|%item-resource%|{.^statut.}%item-name%.}. code in hfs events is

[+upload completed]
{.if|{.^statut.}|{.move|%item-resource%|{.^statut.}%item-name%.}.}

code in template is

[upload]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
{.$copyright.}
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
   <title>{.!lv_upload.}</title>
   <link rel="shortcut icon" href="/favicon.ico"/>
   <script type="text/javascript" src="/template/rawr_default/code/rawr_main.js"></script>
   <script type="text/javascript">
      var theme="{.!theme.}";
      var mod_statistics="{.!mod_statistics.}";
      //Language Strings
      var lv_hideTitle="{.!lv_hideTitle.}";
      var lv_showTitle="{.!lv_showTitle.}";
      
       function RegainFocus() {

      if((document.getElementById("lista").value).length == 0) {

        document.getElementById("kontrola").style.display = 'none';

      }
     else
     {
       document.getElementById("kontrola").style.display = 'block';
      if(document.getElementById("lista").selectedIndex = 1)
      {
      {.set|statut|C:\Users\gljubic.DRI\Desktop\httpserver\statut\.}
      }
      if(document.getElementById("lista").selectedIndex = 2)
      {
      {.set|statut|C:\Users\gljubic.DRI\Desktop\httpserver\bilans stanja\.}
      }
      if(document.getElementById("lista").selectedIndex = 3)
      {
      {.set|statut|C:\Users\gljubic.DRI\Desktop\httpserver\javne nabavke\.}
      }
      if(document.getElementById("lista").selectedIndex = 4)
      {
      {.set|statut|C:\Users\gljubic.DRI\Desktop\httpserver\racunovodstvena dokumentacija\.}
      }
     }

    }     
   </script>
   <link rel="stylesheet" type="text/css" href="/template/{.!theme.}/code/{.!theme.}_main.css"/>
   <noscript><style type="text/css">.hide{display:none}#f1,#f2,#f3,#f4,#f5,#f6,#f7,#f8,#f9{display:block}</style></noscript>
   <!--[if lte IE 6]>
      <style type="text/css">#mainInner{width:980px}</style>
      <noscript><style type="text/css">#mainInner{width:100%}</style></noscript>
   <![endif]-->
</head>
<body>
<div id="mainOuter">
<div id="mainInner"><div id="mainInner1"><div id="mainInner2"><div id="mainInner3">
   <div id="header">
      <div>
         <div id="bCrumbs">{.breadcrumbs|{:<a href="%bread-url%">{.or|%bread-name%|{.!lv_home.}.}/</a>:}.}</div>
      </div>
   </div>
   <div id="content">
      <div id="navbar">
         <noscript>
            <div class="biggerBtn"><a href="~upload" target="_top"><span>{.!lv_closeTransfers.}</span></a></div>
         </noscript>
         <div class="biggerBtn">
            <a href="javascript:void(0);" onclick="window.open('/~progress','{.!lv_transfers.}','width=300,height=500,left=100,top=100,scrollbars=1,resizable=1');" class="hide"><span>{.!lv_openTransfers.}</span></a>
            <noscript><a href="~upload+progress" target="_top"><span>{.!lv_openTransfers.}</span></a></noscript>
         </div>
         {.if|{.{.!btn_back.}=on.}|<div id="backBtn"><a href="%encoded-folder%" target="_parent"><span>{.!lv_back.}</span></a></div>.}
      </div>
      <table cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
         <td width="100%" valign="top" id="tableCol">
            %folder-comment%
            <div class="contModule">
               <div class="contHeading">
{.if|{.{.!mod_statistics.}=on.}|
                  <span class="hide">
                     <a href="javascript:pinModule('moduleCol');" id="moduleCol_Link" title="{.!lv_hideTitle.}"><img src="/template/{.!theme.}/images/show.gif" align="top" alt=""/></a>
                  </span>
.}
                  &nbsp;
               </div>
               <div class="contContent" align="center" >
               
                  <form action="%encoded-folder%" id="kontrola" hidden name="upfrm" target="_parent" method="post" enctype="multipart/form-data"  onsubmit="disableBtns();">
                     <input class="uploadInput"  name="upbtn" value="{.!lv_upload.}" type="submit"/>
                     <input class="uploadInput hide"  name="more" onclick="addInput();" value="{.!lv_addInput.}" type="button"/><br/>
                     <input type="file" name="fileupload1"  size="40"/>
                     <input id="f1" type="file" name="fileupload2" size="40"/>
                     <input id="f2" type="file" name="fileupload3" size="40"/>
                     <input id="f3" type="file" name="fileupload4" size="40"/>
                     <input id="f4" type="file" name="fileupload5" size="40"/>
                     <input id="f5" type="file" name="fileupload6" size="40"/>
                     <input id="f6" type="file" name="fileupload7" size="40"/>
                     <input id="f7" type="file" name="fileupload8" size="40"/>
                     <input id="f8" type="file" name="fileupload9" size="40"/>
                     <input id="f9" type="file" name="fileupload10" size="40"/>
                  </form>
                  
               </div>
            </div>
         </td>
           <td width="100%" valign="top" id="tableCol">
         <div class="contModule">
               <div class="contHeading">
               Изаберите тип документа
                     </div>
               <div class="contContent" align="center">
         <form>
         <select id="lista" name="metodologija" onclick="javascript:RegainFocus();">
         <option value="" selected="selected" ></option>
  <option value="statut" >statut</option>
  <option value="bilans stanja" >bilans stanja</option>
  <option value="racunovodstvena dokumentacija" >racunovodstvena dokumentacija</option>
  <option value="javne nabavke" >javne nabavke</option>
</select>
</form>

can you help me


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
when variables are used, it does have a life span that the time for creating a web page, it is not possible to pass these variables 'local' from template to events, this and why that were created to Global variables that are defined as hfs is active 

this requires precede the name with a #,   {.set|#myvar|Something.}   -->>  {.^#myvar.}

a disadvantage is that as is the variable is the same for all users, it is however possible to include the user's name as part of the name or other information linked to the user

 {.set|#%user%-myvar|Something.}   -->>  {.^#%user-myvar.}

for sections and events, it is not easy at first glance to determine the order of appearance without analysing the source code, yet there is a little trick that uses the log hfs

wherever it's necessary, use the macro "add to log" by including  the name of the section or the event as well as the variables we want to ensure that they are well defined

This example explains all

[upload completed]
{.add to log| event upload completed  by %user%.}


[upload-success]
.....
{.add to log| section upload-success  by %user%.}

15:31:50 127.0.0.1 {localhost} Uploading test_file.txt
15:31:50 127.0.0.1 {localhost} event upload completed by mars
15:31:50 127.0.0.1 {localhost} Fully uploaded test_file.txt - 72 @ 3.5 KB/s
15:31:50 127.0.0.1 {localhost} section upload-success by mars
15:31:50 127.0.0.1 {localhost} Requested POST /upload/





Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
in template i created function
<script type="text/javascript">
function izbor() {
      if(document.getElementById("lista").selectedIndex = 2)
      {
      {.set|#bs|2.}
      }
         if(document.getElementById("lista").selectedIndex = 1)
      {
      {.set|#statut|1.}
      }
}
</script>
 <form >
         <select id="lista" name="metodologija"  onclick="javascript:izbor();">
         <option value="" ></option>
  <option value="statut" >statut</option>
  <option value="bilans stanja" >bilans stanja</option>
  <option value="racunovodstvena dokumentacija" >racunovodstvena dokumentacija</option>
  <option value="javne nabavke" >javne nabavke</option>
</select>
</form>
that set variable #bs on 2 if is selected second element  in listbox
and in hfs events
i check this variable

[+upload completed]

{.if|{.^#bs.}==2|{.move|%item-resource%|%folder%/bilans stanja/%item-name%.}.}
{.if|{.^#statut.}==1|{.move|%item-resource%|%folder%/statut/%item-name%.}.}


but if statement is not working, if i have for example two if statement just is working first move command {.move|%item-resource%|%folder%/bilans stanja/%item-name%.} and nothing other.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
an IF macro must be used as it

[.if|condition|{: do this if TRUE :}|{:else do that :} .}


in your example the macro move is performed from the first line whatever the value of bs because you forgot the quotes {: :} , and in addition it is not possible in the second line to move something that is no longer in the place where it is supposed to be


I opted for the following actions

if (bs==2) and (statut==1)  then
   copy source to destination1
   move source to destination2
else
   if (bs==2)  move source to destination1
   if (statut==1)  move source to destination2
end

[+upload completed]

{.if|{.and|{.=|{.^#bs.}| 2.}|{.=|{.^#statut.}|1.}/and.}|{:
      {.copy|%item-resource%|%folder%/bilans stanja/%item-name%.}
      {.move|%item-resource%|%folder%/statut/%item-name%.}
   :}|{:
      {.if|{.=|{.^#bs.}| 2.}|{: {.move|%item-resource%|%folder%/bilans stanja/%item-name%.}:}/if.}
      {.if|{.=|{.^#statut.}|1.}|{: {.move|%item-resource%|%folder%/statut/%item-name%.}:}/if.}
:}/if.}


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
<quote> and in addition it is not possible in the second line to move something that is no longer in the place where it is supposed to be
</quote>

the second line for moving in another folder in hfs events i use if is selected second element in template after uploading file, then the file is the place where it is supposed to be


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
I used your code

  {.if|{.=|{.^#bs.}| 2.}|{: {.move|%item-resource%|%folder%/bilans stanja/%item-name%.}:}/if.}
      {.if|{.=|{.^#statut.}|1.}|{: {.move|%item-resource%|%folder%/statut/%item-name%.}:}/if.}
:}/if.}

but when i select element in which is set variable #statut, after uploading file, this file is moving in folder bilans stanja, not in statut. The first line is executing in hfs event, not the second line. Why?
What i do?
« Last Edit: July 07, 2016, 07:38:03 PM by gogi1000 »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
the two lines do attempt to move the source file, it can not duplicate it into two identical files using only displacement

if an object is in front of you and that you move it to your left, it is no longer possible to have before you move to the right

for this to be possible, we must make a copy of the original that is placed on the left, and only then the original will be moved to the right


use my code directly below, it takes account of choice for BS and STATUS,

{.if|{.and|{.=|{.^#bs.}| 2.}|{.=|{.^#statut.}|1.}/and.}|{:
      {.copy|%item-resource%|%folder%/bilans stanja/%item-name%.}
      {.move|%item-resource%|%folder%/statut/%item-name%.}
   :}|{:
      {.if|{.=|{.^#bs.}| 2.}|{: {.move|%item-resource%|%folder%/bilans stanja/%item-name%.}:}/if.}
      {.if|{.=|{.^#statut.}|1.}|{: {.move|%item-resource%|%folder%/statut/%item-name%.}:}/if.}
:}/if.}



two options checked -> file is first duplicated inside BS, and is moved next to STATUS

1 option checked -> file is  moved to the "checked" folder

0 option checked ->  file remains in the upload folder


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
sorry,

no, you dont understand

two options checked -> file is first duplicated inside BS, and is moved next to STATUS
1 option checked -> file is  moved to the "checked" folder
0 option checked ->  file remains in the upload folder

before uploading

select first element in listbox: 1 option checked

after uploading file

file is  moved to the "checked" folder

before uploading

select second element in listbox: 2 option checked
 i choose another file for uploading

after uploading file
 
file is  moved to the second "checked" folder

i hope that you understand me


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
more carefully at your part of the template, I came to understand the idea of what you wanted to get, I apologize in advance for this lost time

your code is too complex, no macro can be executed on JavaScript in the browser, everything is performed in advance on the server

that your browser receives in fact it is this code
Quote
<script type="text/javascript">
function izbor() {
      if(document.getElementById("lista").selectedIndex = 2)
      {
      }
         if(document.getElementById("lista").selectedIndex = 1)
      {
      }
}
</script>
 <form >
         <select id="lista" name="metodologija"  onclick="javascript:izbor();">
         <option value="" ></option>
  <option value="statut" >statut</option>
  <option value="bilans stanja" >bilans stanja</option>
  <option value="racunovodstvena dokumentacija" >racunovodstvena dokumentacija</option>
  <option value="javne nabavke" >javne nabavke</option>
</select>
</form>

Event [upload completed] can only be used in conjunction with the [upload] section, but if this event return a value the uploaded file is deleted, you have to use the section [upload-success] in the template
( clear the event file)

accordingly all the select tag must be integrated into the upload form

When informations are sended to the server by using a FORM, all values are available using a specialized macro that will be used in the  part [event] 

what the server see with your form is  a couple of <select name> and the <option value> as
 metodologija="statut"         

the macro  must be
Code: [Select]
{.if|{.=|{.postvar|metodologija.}|statut.}|{: ......:}.}
because you have more one option, i suggest you to use a SWITCH macro instead a IF
Code: [Select]
{switch|{.postvar|metodologija.}|,|
  statut|{: ......:}|
  bilans stanja|{: ......:}|
  racunovodstvena dokumentacija|{: ......:}|
  javne nabavke|{: ......:}|
  {::}
/switch.}

it's more easy when we use number instead words

this code has been tested and work correctly WITH THE DEFAULT TEMPLATE LAST BUILD,

 Put the entire quote into the diff template of the folder properties, only if upload folder is in the vfs  else create a text file named hfs.diff.tpl with the content of quote
Quote
[upload-success]
{.inc|ok.}
<li> <a href="%item-url%">%item-name%</a>
<br />%item-size% @ %smart-speed%B/s
{.if| {.length|%user%.} |{: {.append| %folder-resource%\hfs.comments.txt |{.filename|%item-resource%.}=uploaded by %user%
/append.} :}/if.}
{.set|movedto|{.postvar|{.postvar|metodologija.}.}/set.}
{.switch|{.postvar|metodologija.}|,|
   1,2,3,4|{:{.mkdir|{.filepath|%item-resource%.}\{.^movedto.}\.}{.move|%item-resource%|%folder%{.^movedto.}/.} <p> File moved to %folder%{.^movedto.}/ :}|
   0|{:<p>no move has been performed with this action selected:}|
   {:<p>no action selected:}
/switch.}

[box upload]
   {.if| {.get|can upload.} |{:
      <fieldset id='upload'>
          <legend><img src="/~img32"> {.!Upload.}</legend>
          <form action="." method='post' enctype="multipart/form-data" style='text-align:right;'>
         <div style='text-align:left;'>
            <input type="hidden" name="0" value="">
            <input type="hidden" name="1" value="statut">
            <input type="hidden" name="2" value="bilans stanja">
            <input type="hidden" name="3" value="racunovodstvena dokumentacija">
            <input type="hidden" name="4" value="javne nabavke">

<select id="lista" name="metodologija"  style='background-color:#00dfdf; display:{.if|{.=|%folder-name%|upload.}|initial|none.};'>
            <option selected disabled>prelazak na sljedeci direktorij</option>
            <option value="0" style='background-color:#7f7f00;'></option>
            <option value="1" style='background-color:#007f00;'>statut</option>
            <option value="2" style='background-color:#007f00;'>bilans stanja</option>
            <option value="3" style='background-color:#7f7f00;'>racunovodstvena dokumentacija</option>
            <option value="4" style='background-color:#7f7f00;'>javne nabavke</option>
            </select>
         </div>
 
          <input type='file' name='file' multiple style='display:block;' />
          <input type='submit' value='{.!Upload.}' style='margin-top:0.5em;' />
          </form>
      </fieldset>
   :}.}
[/color]
[/code]

 when MOVE directory does not exists then it's created by the macro MKDIR in the upload folder
you can update your template to reproduce the functionality of the script
« Last Edit: July 09, 2016, 10:57:39 PM by Mars »


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
i changed your code in part

{.if| {.length|%user%.} |{:{.append| C:\Users\user\Desktop\httpserver\hfs.comments.txt |{.filename|%item-resource%.}, %folder%{.^movedto.}, {.time|%item-resource%|format=dd/mm/yyyy.}, %user%  /append.} :}/if.}

but i want that every time when file uploaded, in hfs.comment.txt  new line text typed in the hfs.comment.txt
how?
txks


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
Before going further, it seems to me necessary that you are familiar with the comments files.

These are files for internal use of hfs, and invisible to the remote user

I guess the "C: \ Users \ user \ Desktop \ HTTPServer \" is the main directory hfs.exe and should never be part of vfs to avoid hacking risk.


because you move uploaded files, I assume you want the comments to be included in the same directory of moved files. this condition will require changing the [upload-success] roughly like this
Quote
[upload-success]
{.inc|ok.}
<li> <a href="%item-url%">%item-name%</a>
<br />%item-size% @ %smart-speed%B/s
{.if| {.length|%user%.} |{: {.append| %folder-resource%\hfs.comments.txt |{.filename|%item-resource%.}=uploaded by %user%
/append.} :}/if.}

{.set|movedto|{.postvar|{.postvar|metodologija.}.}/set.}
{.switch|{.postvar|metodologija.}|,|
   1,2,3,4|{:{.mkdir|{.filepath|%item-resource%.}\{.^movedto.}\.}{.move|%item-resource%|%folder%{.^movedto.}/.}
 <p> File moved to %folder%{.^movedto.}/ :}|
   0|{:<p>no move has been performed with this action selected:}|
   {:<p>no action selected:}
/switch.}

{.if| {.length|%user%.} |{: {.append| %folder-resource%\{.^movedto.}\hfs.comments.txt |{.filename|%item-resource%.}=%folder%{.^movedto.}, {.time|%item-resource%|format=dd/mm/yyyy.}, %user%
/append.} :}/if.}