Re: problems with CGI.pm upload feature

2005-09-20 Thread Scott R. Godin

Charles K. Clarkson wrote:

Scott R. Godin  wrote:

: Regrettably this isn't getting me any closer to a resolution --
: what about the code? can anyone see anything I might have
: overlooked? done wrong? should it, in fact, be working right
: now?

   Did you test to be certain that @file actually holds the contents
of the uploaded file?

use CGI::Carp 'fatalsToBrowser;
my @file = <$fields{file_attached}>;
die @file;

Use a small file for the test.

 
: I had hoped this would be pretty straightforward, and tried my

: best to follow the examples in the docs and sample files, but
: I'm at a complete dead-end here. 
: 
: Anyone?



I haven't looked at the docs but shouldn't 'Data' be set to
an array reference, not an array?

$message->attach(
Type=> 'AUTO',
Data=> @file,
Disposition => 'attachment',
Filename=> param('file_attached'),
Encoding=> 'base64',
);

Use:

Data => [EMAIL PROTECTED],



That didn't work, but changing 'Data' to 'FH' did work, instead of slurping the 
file into an array, I passed the filehandle directly to the object's attach method.


Later, I additionally changed the Type to "BINARY" as MIME::Types doesn't seem 
to be installed on the system, (as Yahoo's mail attachment scanner showed the 
file type as 'auto/' for some reason), and everything still seems to be working 
fine.


now everything seems to be hunky dory. Don't know why it made a difference. but 
at least it works now. *headdesk*



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: problems with CGI.pm upload feature

2005-09-19 Thread Charles K. Clarkson
Scott R. Godin  wrote:

: Regrettably this isn't getting me any closer to a resolution --
: what about the code? can anyone see anything I might have
: overlooked? done wrong? should it, in fact, be working right
: now?

   Did you test to be certain that @file actually holds the contents
of the uploaded file?

use CGI::Carp 'fatalsToBrowser;
my @file = <$fields{file_attached}>;
die @file;

Use a small file for the test.

 
: I had hoped this would be pretty straightforward, and tried my
: best to follow the examples in the docs and sample files, but
: I'm at a complete dead-end here. 
: 
: Anyone?


I haven't looked at the docs but shouldn't 'Data' be set to
an array reference, not an array?

$message->attach(
Type=> 'AUTO',
Data=> @file,
Disposition => 'attachment',
Filename=> param('file_attached'),
Encoding=> 'base64',
);

Use:

Data => [EMAIL PROTECTED],

HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: problems with CGI.pm upload feature

2005-09-19 Thread Scott R. Godin

Scott R. Godin wrote:


script is at http://phpfi.com/78748



Possibly used the wrong web browser to upload the file. Not all of them
support this feature. Firefox does not. It will however provide the CGI
script with the file name.





Firefox doesn't support file uploads?  I use it all the time to test
scripts that accept uploads.

Huh?



It'd be news to me too -- I've used firefox for uploads plenty of times.


Regrettably this isn't getting me any closer to a resolution -- what about the 
code? can anyone see anything I might have overlooked? done wrong? should it, in 
fact, be working right now?


I had hoped this would be pretty straightforward, and tried my best to follow 
the examples in the docs and sample files, but I'm at a complete dead-end here.


Anyone?

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: problems with CGI.pm upload feature

2005-09-18 Thread Scott R. Godin

Wiggins d'Anconia wrote:

Bill Stephenson wrote:

On Sep 16, 2005, at 7:51 PM, Scott R. Godin wrote:

Wiggins d'Anconia wrote:

Scott R. Godin wrote:

script is at http://phpfi.com/78748

I followed the instructions in CGI.pm as best I could, and from what I
read the upload() function is supposed to return a filehandle ? (it
doesn't say whether this is a direct FH to the tempfile or not)

I had dome some preliminary testing with one-liners and was pretty sure
this would work, but what I wind up with in the attachment is a file
containing the name of the file, not its actual contents.

what did I do wrong? I can't figure it out. :/



Possibly used the wrong web browser to upload the file. Not all of them
support this feature. Firefox does not. It will however provide the CGI
script with the file name.





Firefox doesn't support file uploads?  I use it all the time to test
scripts that accept uploads.

Huh?



It'd be news to me too -- I've used firefox for uploads plenty of times.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: problems with CGI.pm upload feature

2005-09-17 Thread Wiggins d'Anconia
Bill Stephenson wrote:
> On Sep 16, 2005, at 7:51 PM, Scott R. Godin wrote:
> 
>> Wiggins d'Anconia wrote:
>>
>>> Scott R. Godin wrote:
>>>
 script is at http://phpfi.com/78748

 I followed the instructions in CGI.pm as best I could, and from what I
 read the upload() function is supposed to return a filehandle ? (it
 doesn't say whether this is a direct FH to the tempfile or not)

 I had dome some preliminary testing with one-liners and was pretty sure
 this would work, but what I wind up with in the attachment is a file
 containing the name of the file, not its actual contents.

 what did I do wrong? I can't figure it out. :/
> 
> 
> Possibly used the wrong web browser to upload the file. Not all of them
> support this feature. Firefox does not. It will however provide the CGI
> script with the file name.
> 
> Kindest Regards,
> 
> -- 
> Bill Stephenson
> 
> 

Firefox doesn't support file uploads?  I use it all the time to test
scripts that accept uploads.

Huh?

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: problems with CGI.pm upload feature

2005-09-17 Thread Bill Stephenson

On Sep 16, 2005, at 7:51 PM, Scott R. Godin wrote:


Wiggins d'Anconia wrote:

Scott R. Godin wrote:

script is at http://phpfi.com/78748

I followed the instructions in CGI.pm as best I could, and from what 
I

read the upload() function is supposed to return a filehandle ? (it
doesn't say whether this is a direct FH to the tempfile or not)

I had dome some preliminary testing with one-liners and was pretty 
sure

this would work, but what I wind up with in the attachment is a file
containing the name of the file, not its actual contents.

what did I do wrong? I can't figure it out. :/


Possibly used the wrong web browser to upload the file. Not all of them 
support this feature. Firefox does not. It will however provide the CGI 
script with the file name.


Kindest Regards,

--
Bill Stephenson


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: problems with CGI.pm upload feature

2005-09-17 Thread Scott R. Godin

Wiggins d'Anconia wrote:

Scott R. Godin wrote:


script is at http://phpfi.com/78748

I followed the instructions in CGI.pm as best I could, and from what I
read the upload() function is supposed to return a filehandle ? (it
doesn't say whether this is a direct FH to the tempfile or not)

I had dome some preliminary testing with one-liners and was pretty sure
this would work, but what I wind up with in the attachment is a file
containing the name of the file, not its actual contents.

what did I do wrong? I can't figure it out. :/




Just because it is easy to overlook and fairly common, did you include
the 'enctype' in the form tag?  For instance,

[form enctype="multipart/form-data" action="/cgi-bin/request" method="POST"]



Good call, but yeah I did make sure that got done. It's good to point that out 
as unless you generated the form with CGI.pm itself, it's easy to miss.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: problems with CGI.pm upload feature

2005-09-16 Thread Wiggins d'Anconia
Scott R. Godin wrote:
> script is at http://phpfi.com/78748
> 
> I followed the instructions in CGI.pm as best I could, and from what I
> read the upload() function is supposed to return a filehandle ? (it
> doesn't say whether this is a direct FH to the tempfile or not)
> 
> I had dome some preliminary testing with one-liners and was pretty sure
> this would work, but what I wind up with in the attachment is a file
> containing the name of the file, not its actual contents.
> 
> what did I do wrong? I can't figure it out. :/
> 

Just because it is easy to overlook and fairly common, did you include
the 'enctype' in the form tag?  For instance,

[form enctype="multipart/form-data" action="/cgi-bin/request" method="POST"]

HTH,

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]