Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   CGI: how to test existence of file to upload? (http://www.velocityreviews.com/forums/t869999-cgi-how-to-test-existence-of-file-to-upload.html)

J Krugman 07-08-2003 03:24 PM

CGI: how to test existence of file to upload?
 



I'm using CGI.pm to write a CGI form. This form includes a filefield.
How can I test if the file entered by the user actually exists?

(I tried using "defined fileno $q->param('filename')", but it
returns true whether or not the file 'filename' exists.)

TIA,

-Jill


The Sender 07-08-2003 03:24 PM

Re: CGI: how to test existence of file to upload?
 
At some time in the past J Krugman wrote :

>
>
>
> I'm using CGI.pm to write a CGI form. This form includes a filefield.
> How can I test if the file entered by the user actually exists?
>
> (I tried using "defined fileno $q->param('filename')", but it
> returns true whether or not the file 'filename' exists.)
>
> TIA,
>
> -Jill


Hi Jill,

You can't since you don't have file access to the Client's Machine. You'll
just have to rely on them I'm afraid not to tell porkies.

--
Regards,

William

Alan J. Flavell 07-08-2003 04:53 PM

Re: CGI: how to test existence of file to upload?
 
On Tue, Jul 8, J Krugman inscribed on the eternal scroll:

> I'm using CGI.pm to write a CGI form. This form includes a filefield.
> How can I test if the file entered by the user actually exists?


What is it that you think you need to know? If they upload some data
by that means, you'll get it. If they don't, you won't.

> (I tried using "defined fileno $q->param('filename')", but it
> returns true whether or not the file 'filename' exists.)


Are you confused about where this file actually sits?

They specify a file on their computer. The form submission uploads it
to your server. You're wasting your time looking for _their_ actual
file on _your_ computer. You just get the data (and usually an
indication of what the local file had been called on their machine).

This has nothing specific to do with Perl: it would be the same
principle in any server-side CGI script, no matter what language.


All times are GMT. The time now is 03:58 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.