[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] File uploading



Hi,

>Is it possible, using MacPerl, to have a form button that allows a 
>user to browse his or her HD, select a file, and have that file be 
>automatically uploaded? Would there be platform/browser limitations?

I'm not quite sure about what you mean here. There are two 
possibilities that I can think of:

a) You wish to have the user upload a file they selected on their 
computer to the web server over http.

b) You wish the user to select a file from the server and download it 
to their computer using http.

I can do a) easily enough, but b) requires, as far as I am aware, a 
cgi to generate a directory structure or something similar as a web 
page. This I have done often, but not in quite the way you describe. 
So, presuming a), the easiest answer is to use the remotefile tag. 
I'm not sure when it came in, but it does work on both netscape and 
explorer 4.x.

eg:

<FORM ENCTYPE="multipart/form-data" ACTION="(virtual path)">
<P>File: <INPUT NAME="remotefile" TYPE="file"></P>
<P><INPUT TYPE="submit" VALUE="Send"></P>
</FORM>

At the other end you will, of course, need a server which can accept 
this - webstar has a plug-in that ships with the server that will do 
it, but beyond that you will have to look around. Under MacPerl I 
have not worked out a way to handle large files, although I have 
written a Q&D perl script which will handle small files ok. It seems 
that the data is sent in two chunks do to, I belive, some sort of 
limit over a http connection - if it is small, then the data is just 
contained in the one chunk, which MacPerl can have access to - but 
larger files will use both, and MacPerl, under WebStar, can't get 
access to the second part. However, I am sure that there is a 
workaround somewhere, although it may not be possible on servers 
running under OS 8/9.

Regards,

Adam.
-- 
---------------------------------------------------
Web Support Officer
Room 2.51, Law and Commerce Building
Faculty of Education, Humanities, Law and Theology
Flinders University
Phone (08) 8201-3628 (before 1:00pm)
Phone (08) 8201-3990 (after 1:00pm)

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org