Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: file upload using Embperl

by Anonymous Monk
on Nov 15, 2011 at 14:22 UTC ( #938184=note: print w/replies, xml ) Need Help??

in reply to Re: file upload using Embperl
in thread file upload using Embperl

Sorry ....
Here is the HTML form informations
<form action="load.html" name="form1" method="post" enctype="multipart +/form-data"> <table> <tr class="cell4"> <td>Select EXCEL rate sheet</td> <td><input type="file" name="file" value=""></td> </tr> <tr class="cell3"> <td>&nbsp;</td> <td><input type="submit" name="upload" value="upload"></td> </tr> </table> </form>

and Embperl code used is
if((defined $fdat{file} && $fdat{file}) && $fdat{upload}) { $filename = "/tmp/sample.txt"; open (FILE, "> $filename") || die("open failed: $!"); while (read($fdat{file}, $buffer, 32768)) { print FILE $buffer || die("print test: $!"); } close FILE || die("close test: $!"); }
If we remove enctype="multipart/form-data" form property, can see the form data (filename) after submiting the page.
includng enctype="multipart/form-data" in form will give undef filename. Any idea?

Replies are listed 'Best First'.
Re^3: file upload using Embperl
by Anonymous Monk on Nov 17, 2011 at 11:15 UTC

    Compare your code to embperl upload ( Embperl-2.4.0/test/html/upload.htm )

    In fact, I would use Embperl-2.4.0/test/html/upload.htm to figure things out

    Testing for ref $fdat{upload} seems simplest

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://938184]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2018-06-25 20:05 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (128 votes). Check out past polls.