Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > existence and size of client file

Reply
Thread Tools

existence and size of client file

 
 
Asterbing
Guest
Posts: n/a
 
      04-14-2006
Is there a way to test the existence and size of a client file ? This to
avoid any unuseful traffic (upload, serveur file test, unlink if too
big) and report to user as fast as possible (upload limit being high in
some cases I've to treat ; some tenth of MB).
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      04-14-2006
Asterbing wrote:
> Is there a way to test the existence and size of a client file ?


Depending on what kind of client you are talking about, maybe. Like for
mirroring systems that's a key functionality.

But what does that have to do with Perl?

jue


 
Reply With Quote
 
 
 
 
Asterbing
Guest
Posts: n/a
 
      04-14-2006
In article <KhM%f.20266$wH1.3677@trnddc03>, http://www.velocityreviews.com/forums/(E-Mail Removed) says...
> Asterbing wrote:
> > Is there a way to test the existence and size of a client file ?

>
> Depending on what kind of client you are talking about, maybe. Like for
> mirroring systems that's a key functionality.
>


Oh no, in framework of a CGI.

> But what does that have to do with Perl?


Because I'm talking about CGI written in Perl for which I've to
incorporate a feature which will allow users to upload a file. So, my
question was implicitely about Perl, but could be explicitely
reformulated as this : "Is there a way to test the existence and size of
a client file in a CGI written in Perl ? -e and -s are server-side only,
unless mistake.
 
Reply With Quote
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      04-14-2006
Asterbing wrote:
> Is there a way to test the existence and size of a client file ? This to
> avoid any unuseful traffic (upload, serveur file test, unlink if too
> big)


Maybe you want to check the $ENV{CONTENT_LENGTH} variable before upload.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
Asterbing
Guest
Posts: n/a
 
      04-14-2006
In article <(E-Mail Removed)>, (E-Mail Removed) says...
> Asterbing wrote:
> > Is there a way to test the existence and size of a client file ? This to
> > avoid any unuseful traffic (upload, serveur file test, unlink if too
> > big)

>
> Maybe you want to check the $ENV{CONTENT_LENGTH} variable before upload.
>
>


Well, but the form will only POST the path to file for uploading, not
the length of the file data itself.
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      04-14-2006
Asterbing wrote:
> In article <KhM%f.20266$wH1.3677@trnddc03>, (E-Mail Removed)
> says...
>> Asterbing wrote:
>>> Is there a way to test the existence and size of a client file ?

>>
>> Depending on what kind of client you are talking about, maybe. Like
>> for mirroring systems that's a key functionality.

>
> Oh no, in framework of a CGI.


I suppose you mean HTTP because for the Commone Gateway Interface there
isn't really a client unless you call the CGI program the client because the
other end of the communication line is a web server.

And no, the HTT-Protocol does not provide any means for such inquiries by
the server to the client.
If you think about it it would be quite a security hole if there was such a
method, wouldn't it?

>> But what does that have to do with Perl?

>
> Because I'm talking about CGI written in Perl


Which still doesn't make it a question about Perl because your question and
the answer would be exactly the same even if your CGI program would be
written in C or LOGO or Pascal or Prolog.

First of all you have a question about HTTP, then maybe about CGI.

jue


 
Reply With Quote
 
Asterbing
Guest
Posts: n/a
 
      04-14-2006
In article <9vO%f.9$7w6.2@trnddc02>, (E-Mail Removed) says...
> First of all you have a question about HTTP, then maybe about CGI.
>


Seen this way, yes, but I could reformulate indefinitively and a day or
another find the angle you wish... For example : does -e, -s or open
authorized to reach client-side files ?
 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      04-14-2006
Asterbing <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> In article <9vO%f.9$7w6.2@trnddc02>, (E-Mail Removed) says...
>> First of all you have a question about HTTP, then maybe about CGI.
>>

>
> Seen this way, yes, but I could reformulate indefinitively and a day or
> another find the angle you wish...


As someone else mentioned in a different thread recently, I know what the
words mean but the sentence above makes no sense.

> For example : does -e, -s or open authorized to reach client-side files ?


What client? NFS, SSH etc?

Your question has been answered already: A CGI script running on a web
server has no way of inspecting the file system on the HTTP client that is
making the request to the web server.

The question has nothing whatsoever to do with Perl, and your attempt to
get cute is not appreciate it.

Bye.

Sinan
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      04-14-2006
Asterbing wrote:
> In article <9vO%f.9$7w6.2@trnddc02>, (E-Mail Removed) says...
>> First of all you have a question about HTTP, then maybe about CGI.
>>

>
> Seen this way, yes, but I could reformulate indefinitively and a day
> or another find the angle you wish... For example : does -e, -s or
> open authorized to reach client-side files ?


Answer:
Yes, if you are talking about e.g. an NFS client or if files are shared
between computers.
No, if you are talking about e.g. an HTTP client.

Again, which part of "this has nothing to do with Perl but only with your
application domain" don't you understand?

jue



 
Reply With Quote
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      04-14-2006
Asterbing wrote:
> In article <(E-Mail Removed)>, (E-Mail Removed) says...
>>Asterbing wrote:
>>>Is there a way to test the existence and size of a client file ? This to
>>>avoid any unuseful traffic (upload, serveur file test, unlink if too
>>>big)

>>
>>Maybe you want to check the $ENV{CONTENT_LENGTH} variable before upload.

>
> Well, but the form will only POST the path to file for uploading, not
> the length of the file data itself.


True, but $ENV{CONTENT_LENGTH} will hold the length of the whole
request, and if it exceeds a certain value, it may not be desirable to
even parse the request.

--
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
distutils - script install check file existence before copy? bwooster47@gmail.com Python 0 03-04-2007 03:22 AM
mega pixels, file size, image size, and print size - Adobe Evangelists Frank ess Digital Photography 0 11-14-2006 05:08 PM
what is the quickest way to check if I have write permissions to and existence of the file puzzlecracker C++ 4 10-31-2005 12:45 AM
Checking fprintf for errors and testing for existence of a file Jim Hunter C Programming 3 03-06-2005 05:29 PM
Checkup: better way to test for file existence? Matt C++ 14 02-22-2005 12:15 PM



Advertisments