Attachment Too Large? Rewrite Your Whole Post!

Started by Dullstar, September 29, 2017, 01:46:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dullstar

Not sure if there's anything that can be done about this, but...

I tried to post something with an attachment, but it was too large. Rather than throwing an error, and allowing me to edit the post/attachments, everything was cleared, and I had to start entirely over (hence why I just posted a topic with the first post pretty much saying nothing but "placeholder").

Tested with starting a new topic, using Firefox as the browser. I haven't tested what happens if you're replying to an existing topic, but will attempt this and see if it gives the same result.

EDIT: I tested it by attempting to post a reply with a large attachment to this thread. It seems that it takes you to the "Start New Topic" page for some reason if the attachment is too large.

mobius

I agree this can be aggravating. I recommend putting up a warning [better than the current one] on file sizes

Some sites have an "auto-save" feature (you may see it flash occasionally below the text box like "text saved at X:XX XXX". This site does not.
everything by me: https://www.lemmingsforums.net/index.php?topic=5982.msg96035#msg96035

"Not knowing how near the truth is, we seek it far away."
-Hakuin Ekaku

"I have seen a heap of trouble in my life, and most of it has never come to pass" - Mark Twain


Simon

Eeh, that's nasty UI. Thanks, will look into it.

-- Simon

Simon

Yeah, reproduces: Click reply to thread, attach 20 MB file, click Post. Wait until file has uploaded. The site refreshes and presents a blank new-topic form.

Workaround: Back button in the browser restores the form with the written post. (Firefox 55)

This is obviously a terrible workaround because it relies on the browser, who need not be so kind and save such temporary data. :D Options coming to mind:
  • Report upstream (and wait until somebody ever does this, then wait until it sickers through updates),
  • look for forum extensions to install (feeble hope since this is UI misdesign in the core),
  • hack the PHP source in production (Nessy would pitchfork me and it might make the forum hard to upgrade).
-- Simon

Nessy

I would never pitchfork you Simon ;), but in all seriousness I think that this problem can easily be solved using PHP. I can make it so that PHP saves a cookie to the browser that contains the content of the user's post and where it is going to be posted. It will update every few seconds quietly in the background. If the user leaves or the post gets deleted for reasons explained on this thread the cookie will still exist, and the information it stores can be retrieved and pasted automatically in the text box when the user returns. The cookie will only be deleted if the user finally posts or decides to post in another thread. The code would know that by comparing the current topic with the topic saved in that same cookie. If they don't match then the cookie gets cleared for new post content. The advantage of this is that I don't think a user will (or at least very unlikely to) clear their cookies while posting and the cookie will be terminated after posting so it does not linger in the user's browser. If this is done the only page that needs to be updated is the page that is displayed when a user is writing their post.

namida

Could be an issue if people are writing multiple posts at the same time?

Anyway, regarding the attachments, there are two different issues:
- The forum limits to 16MB. I would rather this wasn't changed; this is fairly generous and since hosting costs are based on amount of storage / bandwidth used, it's preferable that larger files get hosted off-site.
- Uploads from Firefox sometimes time out rather than completing. This can happen even with relatively small files (I've seen it on files of about 3MB), and does not happen when using Internet Explorer or Chrome. This issue may have been fixed, as the last time I noticed it was about 6 months ago.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Simon

This bug is still in the site.

Worse, the limit is 10 MB whereas the site claims it's 16 MB. Anything larger than 10 MB, the site will eat it without warning.

The forum leadership is a big mess: I am head admin, and I don't want to touch the PHP in production. But we don't have a test forum instance, we don't have version control, and I've never told anybody to set up stuff. I discussed this last month on the admin board that stuff belongs in version control, namida agreed, but I didn't do anything based on this. Stuff needs to happen, pronto.

Must discuss with Nessy next time I see him online.

-- Simon

namida

#7
Re: 10 MB limit, I have a feeling it may relate to PHP configuration.

From NFS's FAQ:

EDIT following this topic's revival in August 2020: The site is no longer hosted on NFS so this is no longer relevant.

QuoteHow do I customize my PHP configuration?

You can place customized PHP configuration directives in the file /home/conf/php.ini. This file will not exist by default, so you'll have to create it and make sure it is readable but not writable by the web server (644 permissions). These options will be parsed at the master level (above even PHP_INI_SYSTEM); you may use any directive supported by the version of PHP you are using, including those marked as "php.ini only." Your php.ini file is parsed in addition to, not in lieu of, the system php.ini file, so you only need your site-specific changes.

Note: The php.ini file is not parsed on every request. Changes may take a few minutes of idle time to take effect. (Which, if your site is never idle, may mean they never take effect.) If you want to help it along, you can place your site in maintenance mode or temporarily disable it for a minute or two to ensure that all running processes are killed. Use the phpinfo() function to review the running config and confirm that your changes have been processed.

Examples:

upload_max_filesize = "20M"
display_errors = Off
log_errors = On
extension = "/home/protected/mycustomphpextension.so"

For more information about which PHP configuration directives are available at which level, see the official PHP documentation.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

mobius

#8
I just discovered this same issue happens if you attempt to attach an EXE to a post (which I assume is forbidden for fear of viruses? even though it's so simple to just hide an exe in a zip file..........):-\

It seems I was wrong about this; but this issue with filesizes is still unresolved.
everything by me: https://www.lemmingsforums.net/index.php?topic=5982.msg96035#msg96035

"Not knowing how near the truth is, we seek it far away."
-Hakuin Ekaku

"I have seen a heap of trouble in my life, and most of it has never come to pass" - Mark Twain


WillLem

Quote from: Nessy on October 01, 2017, 07:17:27 PM
I can make it so that PHP saves a cookie to the browser that contains the content of the user's post and where it is going to be posted... If the user leaves or the post gets deleted for reasons explained on this thread the cookie will still exist... The cookie will only be deleted if the user finally posts or decides to post in another thread. The code would know that by comparing the current topic with the topic saved in that same cookie. If they don't match then the cookie gets cleared for new post content. The advantage of this is that I don't think a user will (or at least very unlikely to) clear their cookies while posting and the cookie will be terminated after posting so it does not linger in the user's browser.

What's all this about cookies...?