Author Topic: Limits to uploaded files by size?  (Read 2692 times)

0 Members and 1 Guest are viewing this topic.

Offline skb

  • Occasional poster
  • *
  • Posts: 43
    • View Profile
Limits to uploaded files by size?
« on: July 26, 2015, 01:11:39 AM »
Is there an easy way to restrict uploads to "small" sizes, e.g. only files less than 100KB?

Can the system know the file size before it is uploading it? Alternatively, is there any way to abort an upload if the file is larger than a limit? Or, perhaps drop it after the upload is complete? Do we know the size when the [upload completed] event happens? Is it possible to delete a large file at that point?

I fear that this question might be answered already, but the terms I tried to search for (like "file size") are so widely used that I did not find useful results.

Thanks for any pointers.
Steve
« Last Edit: July 26, 2015, 01:18:08 AM by skb »

Offline bmartino1

  • Tireless poster
  • ****
  • Posts: 788
  • I'm only trying to help i mean no offense.
    • View Profile
    • none - google translate
Re: Limits to uploaded files by size?
« Reply #1 on: July 26, 2015, 01:42:25 PM »
i recall a limit for file sizes at one time. To my knowledge, a file would upload the data, but stop at 100 KB(not the full file, file deleted... something like that...) , there would be an error, depending on the file / how it works... PHP is better for this :( ... Sorry, not much help...
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1

Offline LeoNeeson

  • Tireless poster
  • ****
  • Posts: 476
  • Solitario...
    • View Profile
    • twitter.com/LeoNeeson
Re: Limits to uploaded files by size?
« Reply #2 on: July 27, 2015, 08:27:39 AM »
I did this search, and this another search, and I've found that FHFS may be your solution, according to this:

Improve: Uploader.js now specifies the max account size as the max file size also to prevent very large single-file uploads that can exceed the limit (uploader.js)

You may try the latest FHFS version (2.1.2), and find out how "Uploader.js" works. May be raybob can help you better than me. I currently don't have FHFS installed.
Good luck... ;)
• HFS ahora también disponible en Español! (Clic aqui) :)
• HFS is now also available in Spanish! (Click here)

Follow members gave a thank to your post:


Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12890
    • View Profile
Re: Limits to uploaded files by size?
« Reply #3 on: July 27, 2015, 10:41:59 AM »
there's no size limit offered, currently.
IIRC http specifies the size of the whole upload procedure, the sum of all the files, that's a bummer.
Anyway you could always check the size of the file at the end of its upload, it's quite late but better than nothing.
I just tried, and found that it is not working for some reason. I'm trying to fix it.

Offline bmartino1

  • Tireless poster
  • ****
  • Posts: 788
  • I'm only trying to help i mean no offense.
    • View Profile
    • none - google translate
Re: Limits to uploaded files by size?
« Reply #4 on: July 27, 2015, 06:14:24 PM »
i can recommend using JavaScript to check the file, but not very good at JavaScript / jqurey code...

http://stackoverflow.com/questions/7497404/get-file-size-before-uploading
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1

Follow members gave a thank to your post:


Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12890
    • View Profile
Re: Limits to uploaded files by size?
« Reply #5 on: July 30, 2015, 11:58:20 AM »
ok, i fixed the problem for the next release (coming very soon, 2.3f), and you will be able to check %item-size-kb% in the [upload completed]

So, if you want to set a limit to 1MB, you should check if it's more than 1000.

I added a specific capability to it, and it's to refuse uploads. Any text that you will give will be considered a reason for refusal and the file will automatically be deleted.

This is an example

[upload completed]
{.if|{.%item-size-kb% > 500.}|Sorry, limit of 500KB.}

Follow members gave a thank to your post:


Offline skb

  • Occasional poster
  • *
  • Posts: 43
    • View Profile
Re: Limits to uploaded files by size?
« Reply #6 on: August 09, 2015, 01:07:38 AM »
Wow, thanks! That is quite a nice solution! I was thinking I'd need to code some macros; very great to have it as a new built-in! :)

Offline skb

  • Occasional poster
  • *
  • Posts: 43
    • View Profile
Re: Limits to uploaded files by size?
« Reply #7 on: August 09, 2015, 01:12:48 AM »
Ah, LeoNeeson, very clever using Google to search the forum! I'd never thought of that, and was trying to find stuff using only the local search tool. Thanks for the examples!

Steve

Offline LeoNeeson

  • Tireless poster
  • ****
  • Posts: 476
  • Solitario...
    • View Profile
    • twitter.com/LeoNeeson
Re: Limits to uploaded files by size?
« Reply #8 on: August 09, 2015, 07:34:58 AM »
You're welcome, Steve. And thank you for suggesting this new feature. :)
• HFS ahora también disponible en Español! (Clic aqui) :)
• HFS is now also available in Spanish! (Click here)