$SIG{__DIE__} = \&my_die; use CGI; $C = new CGI; if ($C->param) { $file=$C->param("upload"); ### if you need to do fancy placement look at ### File::Basename open (UPLOAD, "/path/to/file"); while ($bytesread=read($file,$buffer,1024)) { print UPLOAD $buffer; } print $C->header; print $C->start_html; print qq(<p>file uploaded successfully</p>); print $C->end_html; exit; } else { print $C->header; print $C->start_html; print $C->start_multipart_form; print $C->filefield(-name=>'file'); print qq(<input type="submit" name="submit" value="submit"> </form> ); print $C->end_html; exit; } sub my_die { print $C->header; print $C->start_html; print $_; print $C->end_html; }
Originally posted as a Categorized Answer.
In reply to Re: How can I get started with a file upload script?
by Anonymous Monk
in thread I need a script for web file uploading.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |