You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by jonathan vanasco <jv...@mastersofbranding.com> on 2005/04/03 05:25:20 UTC

How do I catch errors with Apache::Upload

Apache::Upload seems to be  working fine -- as long as I upload 
something

If i upload nothing, i get all sorts of errors.  i assumed I would get 
them, as this problem came about while I was trying to work in routines 
for handling data of the wrong type.  I just can't figure out how one 
catches the errors.

so, how does one validate the integrity of an upload (in terms of 
something actually being uploaded).  trying to access any aspect of the 
upload object triggers an error, and the docs dont show me any sort of 
other way to access the error.


Re: How do I catch errors with Apache::Upload

Posted by jonathan vanasco <jv...@mastersofbranding.com>.
I can't seem to get that working, best as I try.

Does anyone have other suggestions?

My main problem right now, is that if I upload 'nothing', i get an 
error of the sort:
   can't find Content-Type header

According to the mp1 docs/examples:

	$upload = $apr->upload('fieldname')
	if (!$upload)
	{
		# no upload
	}
	else
	{
		# yay upload
	}

I'm probably interpreting this wrong, but according to the MP2 docs :

	$upload = $apr->upload('fieldname')
	if ( (ref $upload) eq 'Apache::Upload::Error'  )
	{
		# no upload
	}
	else
	{
		# yay upload
	}

Which might work... but in the case that you have a  file upload, and 
click the  file button -- but don't select a file, $upload seems to 
stay a valid upload object -- but performing any Apache::Upload method 
on it causes a 500 error

Anyone else with a suggestion?  This is killing me.

On Apr 2, 2005, at 10:37 PM, Fred Moyer wrote:
>
> I was doing something similar several months ago where I needed to
> validate the incoming data.  This may not be what you need but it 
> worked
> in my case, and it's likely there is a simpler way to do it.  Here's a
> link to a question I posted on the apreq-dev list regarding this - hope
> it helps.
>
> http://marc.theaimsgroup.com/?l=apreq-dev&m=109150075712271&w=2
>


Re: How do I catch errors with Apache::Upload

Posted by Fred Moyer <fr...@taperfriendlymusic.org>.
jonathan vanasco wrote:
> 
> Apache::Upload seems to be  working fine -- as long as I upload something
> 
> If i upload nothing, i get all sorts of errors.  i assumed I would get
> them, as this problem came about while I was trying to work in routines
> for handling data of the wrong type.  I just can't figure out how one
> catches the errors.
> 
> so, how does one validate the integrity of an upload (in terms of
> something actually being uploaded).  trying to access any aspect of the
> upload object triggers an error, and the docs dont show me any sort of
> other way to access the error.

I was doing something similar several months ago where I needed to
validate the incoming data.  This may not be what you need but it worked
in my case, and it's likely there is a simpler way to do it.  Here's a
link to a question I posted on the apreq-dev list regarding this - hope
it helps.

http://marc.theaimsgroup.com/?l=apreq-dev&m=109150075712271&w=2