Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > "Inappropriate ioctl for device" while upload()ing using CGI.pm

Reply
Thread Tools

"Inappropriate ioctl for device" while upload()ing using CGI.pm

 
 
latin0511@gmail.com
Guest
Posts: n/a
 
      07-01-2006
I'm using the procedural upload() function from CGI.pm.
In this line:
my $fd_file = upload( 'file' ) or die( "upload() ( $! )" );

I encounter the weird-looking error:
"Inappropriate ioctl for device".

I don't understand what could be the problem. I did exactly like they
say in the manual.
Can you please help me solve this problem?

Thanks a lot!

 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      07-01-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I'm using the procedural upload() function from CGI.pm.
> In this line:
> my $fd_file = upload( 'file' ) or die( "upload() ( $! )" );


What makes you think that $! contains an appropriate error message if no
file is uploaded?

> I encounter the weird-looking error:
> "Inappropriate ioctl for device".
>
> I don't understand what could be the problem. I did exactly like they
> say in the manual.
> Can you please help me solve this problem?


Use the CPAN module CGI::UploadEasy.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
 
latin0511@gmail.com
Guest
Posts: n/a
 
      07-01-2006

Gunnar Hjalmarsson wrote:
> (E-Mail Removed) wrote:
> > I'm using the procedural upload() function from CGI.pm.
> > In this line:
> > my $fd_file = upload( 'file' ) or die( "upload() ( $! )" );

>
> What makes you think that $! contains an appropriate error message if no
> file is uploaded?

I check that param( 'file' ) exists before that line, if that's what
you mean.
I think that upload() is like open() in some aspect, thats why it
should set $!.

> > I encounter the weird-looking error:
> > "Inappropriate ioctl for device".
> >
> > I don't understand what could be the problem. I did exactly like they
> > say in the manual.
> > Can you please help me solve this problem?

>
> Use the CPAN module CGI::UploadEasy.


I can't do that. I want the program to generate a random name for every
file uploaded, and using UploadEasy it looks impossible.
In addition, UploadEasy is based on CGI.pm, and uses CGI.pm's upload()
function too, so there is no reason why it should work.

 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      07-01-2006
(E-Mail Removed) wrote in
news:(E-Mail Removed) oups.com:

>
> Gunnar Hjalmarsson wrote:
>> (E-Mail Removed) wrote:
>> > I'm using the procedural upload() function from CGI.pm.
>> > In this line:
>> > my $fd_file = upload( 'file' ) or die( "upload() ( $! )" );

>>


....

>> > Can you please help me solve this problem?

>>
>> Use the CPAN module CGI::UploadEasy.

>
> I can't do that. I want the program to generate a random name for
> every file uploaded, and using UploadEasy it looks impossible.
> In addition, UploadEasy is based on CGI.pm, and uses CGI.pm's upload()
> function too, so there is no reason why it should work.


I have not used Gunnar's module, however, I looked at the source code to
learn from it. Looking at it again, I don't see why it should not work.

On the other hand, I note that we have not seen any of your code, so we
have no idea if your problem is really related to CGI.pm or your own
code.

If I were you, I would write a test script using CGI::UploadEasy, and
see if the upload succeeds in the simple case. If it does, then you will
have shown that the problem is related to your code.

Regardless of wheter CGI::UploadEasy works for you, post a short but
complete example exhibiting the problem.

Sinan
 
Reply With Quote
 
latin0511@gmail.com
Guest
Posts: n/a
 
      07-01-2006
Thank you all! I've managed to fix it.
The problem was that my form declaration in HTML looked like this:
<form action="upload.pl" method="post">

instead of:
<form action="upload.pl" method="post" enctype="multipart/form-data">

Thank you all for your time.

 
Reply With Quote
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      07-01-2006
(E-Mail Removed) wrote:
> Thank you all! I've managed to fix it.


Good.

> The problem was that my form declaration in HTML looked like this:
> <form action="upload.pl" method="post">
>
> instead of:
> <form action="upload.pl" method="post" enctype="multipart/form-data">


Can't help noticing thst with CGI::UploadEasy, the browser would have
displayed the following error message:

Error
The content-type at file uploads shall be 'multipart/form-data'.
Make sure that the 'FORM' tag includes the attribute:
enctype="multipart/form-data"

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using ioctl klappnase@web.de Python 1 02-09-2006 01:47 PM
ioctl() help needed for video4linux Kyler Laird Python 0 12-24-2004 11:08 PM
ioctl(2) ? Peter Luciak Python 1 04-24-2004 07:39 PM
Python + ioctl + Windows HOWTO?? Javier Python 1 10-30-2003 10:06 AM
how to make network ioctl call from java Roger Java 1 10-22-2003 10:17 PM



Advertisments