I can pick up the text data and filename easily enough but, whatever I do, I cannot get the binary data. The raw data coming into the server is$data = $q->param('param');
The CGI man page suggests--mkGAOmWzlLaPNjkDQ57CNA9mUc6uoe1JMSRI Content-Disposition: form-data; name="mtdata"; filename="filename" Content-Type: application/octet-stream A whole lot of binary data --mkGAOmWzlLaPNjkDQ57CNA9mUc6uoe1JMSRI Content-Disposition: form-data; name="email" email address --mkGAOmWzlLaPNjkDQ57CNA9mUc6uoe1JMSRI Content-Disposition: form-data; name="mtfilename" file name --mkGAOmWzlLaPNjkDQ57CNA9mUc6uoe1JMSRI--
If POSTed data is not of type application/x-www-form-urlencoded or multipart/form-data but that doesn't work. I've also tried:-my $data = $query->param('POSTDATA');
but that's not working either. I cannot (at the moment) change the content type of the uploaded data - can anyone see what I'm doing wrong?$lightweight_fh = $q->upload('field_name'); # undef may be returned if it's not a valid file handle if (defined $lightweight_fh) { # Upgrade the handle to one compatible with IO::Handle: my $io_handle = $lightweight_fh->handle; open (OUTFILE,'>>','/usr/local/web/users/feedback'); while ($bytesread = $io_handle->read($buffer,1024)) { print OUTFILE $buffer; } }
In reply to Problem uploading file data using CGI by dougconran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |