In the process of my continued work on my own noding system, I implemented something that I thought was quite useful. Useful enough that I think strong consideration should be given to implementing the same thing here (Perlmonks) and perhaps Everything2.

What I did was simply add a "Upload body from file" button in all of my "add item" pages. In my case, I added a:

print "Load from local file:: <input type=file name=fileupload>";
in the form for posting, and then added:
if ($cgi->param("fileupload")) { my $fh=$cgi->param("fileupload"); my $buff; local $_; $buff.=$_ while sysread($fh,$_,4096); $cgi->param("body",$buff); }
in my main handler (body being the name of the textarea in my form, of course).

The reason I think this should be added to Perlmonks is the sheer volume of code that gets posted here. The usefulness of uploading your source then, hitting preview and then adding descriptive text is just, well, too useful to ignore :)

So, those that are capable of this mod, think about it. Thank you!

Replies are listed 'Best First'.
(ar0n) Re: File upload during post
by ar0n (Priest) on May 09, 2001 at 09:48 UTC
    I think it would be better if we would not have this feature.

    When monks post a question to SOPW, it's usually a problem that is highly localised into (no more than) about 20 lines of code. So posting the entire script, which may have several hundred lines of code, does not exactly help the other monks trying to answer the question. Encouraging that behavior is not a good idea, in my humble opinion.

    update mr.nick is right, I misread that.

    ar0n ]

      Who said it had to be in SOPW? There are PLENTY of places here where large code/text is OK to be posted: Craft, Tutorials, Cool Uses for Perl, Snippets...

      Not having the upload feature on SOPW would be fine, but lets not dismiss it out of hand because possible abuse in one area.

Re: File upload during post
by chromatic (Archbishop) on May 09, 2001 at 22:05 UTC
    For what it's worth, annotated code to do this within Everything may be found here.