rejetto forum

macro, md5 & create file

Guest · 4 · 4627

0 Members and 1 Guest are viewing this topic.

ebola

  • Guest
Hi

The macros in HFS are very confusing for me. Is there a way for this task:

- User uploads file
- ul is finished, hfs creates a md5 of the new file, renames file to "the_md5hash_of_the_file.extension", generates a html file with md5 hash as filename and generates in the ul-succesfull-page a link to the md5.html?

As far as I can see there is the option to create and rename files with macros. But how to generate MD5 automatically when a UL is finished? Or is there a way to call a external program to do the job?

As an alternative how would it look like to rename the new uploaded file in a random name containing 16 random numbers and generate a html with the same 16 numbers?


Thx for helping me,
ebola


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
the only macro you are missing is the one to generate the MD5.
i can easily introduce it, and i will soon. stay tuned for new beta releases.

it can be something like {.save|%item-resource%.md5| {.md5file|%item-resource%.}/save.}
that you would insert into section [upload-success]

for the random name you can use {.random number.}
It's all documented in the wiki, as you may know.


I wonder if i should just create an option to hash new uploaded files, or leave this to tricky macros. :-/


ebola

  • Guest
Hi

Thx for your answer :)
I will wait for next betas. Sound just too cool !!

Well, I would love a option to hash new files automatically + generate a file "%filename%.md5" without using macros.


Are there some examples using the different macros? In the wiki we find all the different syntax for all macros but some examples that show the syntax in "reallife" would be more friendly for newcomers. If you first open the macro-wiki you just think "Oh shit, come on!". Macros are cool but at the moment only advanced members take profit from them - for new users this is more than they can handle...

Thx + cheers,
ebola


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
Well, I would love a option to hash new files automatically + generate a file "%filename%.md5" without using macros.

ok, but you won't see it in next build. still undecided.
in the while, i tested this code and it works
{.save|%item-resource%.md5|{.md5 file|%item-resource%.}.}
use it in next build!

mmm, what if uploaded files will behave just accordingly to the feature
menu -> fingerprints -> create fingerprint on addition

wouldn't it be enough?

Quote
Are there some examples using the different macros?

plenty of them, in the "template" board of this forum.
you are right, some examples may be included in the wiki itself.
in the while you can refer the forum.