Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Want to parse your very own attachment uploads without
using a module? That's what you were asking. Simpliest way i've used without a module is called 'cgi-lib.pl' It's a downloadable perl script you include in your perl script and can run on your webserver just fine. http://cgi-lib.berkeley.edu/ I didn't get too deep into your code. I'd rather submit some helpful pointers which may guide you on your way. Basically you want perl to receive the form inputs from an html page on a visitor's computer. Two areas need setting up to do this by yourself with no module: 1. html form needs an enctype modifier. Without this, your browser sends the contents of your form as a simple buffer. Make sure you have the following included in your html form tag code: Now that you did that, you need to read what was received in perl. There are a ton of helpful modules which will do this for you 1000 times better than little ole me could convey, but you said virtual host, without a module. Again, i remind you of cgi-lib.pl, see above. Tinkering with multi-type forms isn't an entire waste of time. You start to see how MIME works which can be handy for custom email readers. To start, take a look at what perl is sending you. Self-testing is the best learning tool here. In particular take a look at your ENV variables when you upload a file to your test script. In particular, look at $ENV{'CONTENT_TYPE'}. $ENV{'CONTENT_TYPE'} has a boundary modifier, parse this. You will use the boundary to delimit the remainder of your form. Once you know the delimiter you can split your uploaded content into it's seperate parts and begin to hack away. Each part has a HEAD and a BODY. The head tells you the filename, and describes the content. The BODY is the content (i.e. your image, or file) described by the HEAD. The HEAD and BODY are seperated by \n\n jtrue In reply to Re: allowing form uploading
by true
|
|