rejetto forum

file types

pcs800 · 19 · 7748

0 Members and 1 Guest are viewing this topic.

Offline pcs800

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
Is there a way to specify only certain file extension that can be uploaded by users?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
yes, it was already asked, try searching the forum.
the solution is editing the template, because it is a feature of html language.


Offline pcs800

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
I did search, I can't seem to find anything, or i get 100 results.
Where is the template? I see nothing accept the exe file.


Offline pcs800

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
Found this but it does not make any difference. I can still upload other file types.

you should edit the template
search for
Quote:
[upload-file]
<input name=fileupload%idx% size=70 type=file><br>


replace with
Quote:
[upload-file]
<input name=fileupload%idx% size=70 type=file accept='application/zip,application/rar'><br>


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile

Offline pcs800

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
I am quite fluent with html, but  the  changes i made did not solve the issue. i would much rather use hfs than some php script, i am not trying to be difficult, i just don't see the problem with the changes i made.
Is there another line that needs to be changed along with that line?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
well, i never did, just had a look at the html reference and reported.
if it doesn't work, maybe it is browser's fault.
you could check other browsers, or find information about compliance of yours.
keep in mind that HTTP is request/reply. if even you ask me to filter out files, HFS has to receive the whole file before discarding. it is much better to avoid the client uploading by acting on the template.


Offline pcs800

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
Ok, so you are saying that if someone tried to upload a 2GB file that was not in my list of ok file types, it would upload and then get deleted?

In any case, i really like the app and want to use it for this purpose.

Any chance you would take a donation in exchange for custom code on the template?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
Quote from: "pcs800"
Ok, so you are saying that if someone tried to upload a 2GB file that was not in my list of ok file types, it would upload and then get deleted?
for server-side filtering, as i depicted, yes

Quote
Any chance you would take a donation in exchange for custom code on the template?
it depends, try making a more precise request.
and...since it is opensource, anyone can do the work, not just me. :)


Offline pcs800

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
Ok, I just need the template to allow 4 types of extensions to be uploaded. That's it.
I will look around for code help on this, thanks anyway.


Offline pcs800

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
Ok I changed this
[upload-file]
<input name=fileupload%idx% size=70 type=file><br>

To this
[upload-file]
<input name=fileupload%idx% size=70 type=file accept='application/zip,application/rar'><br>

And was still able to upload any file type i want.
What  is the deal?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
yes, i noticed it
this is a bad compliance of browsers to html
i don't know any solution ATM


Offline pcs800

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
So this means there is no way with this software to specify file type that can be uploaded?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
maybe using javascript, inside the template


Offline pcs800

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
Javascript? I did not know of a script that could limit uploads to certain file extensions.
Do you?