keyongtech


  keyongtech > perl > 08/2009

 #1  
08-02-09, 03:14 PM
orasnita
Hi,

Due to the file size limitations of the common browsers like IE or Firefox,
I wanted to create a file uploader that doesn't use a browser, but just
posts a file to a program on a server.

I've searched for a module on CPAN that can do this easier, set the HTTP
headers automaticly... but I couldn't find such a thing.

Do you know if there is such a module available, or I would need to write my
own?

Thank you.

Octavian
 #2  
08-02-09, 03:35 PM
Shawn H. Corey
Octavian Râ?ni?? wrote:
> Hi,
>
> Due to the file size limitations of the common browsers like IE or
> Firefox, I wanted to create a file uploader that doesn't use a browser,
> but just posts a file to a program on a server.
>
> I've searched for a module on CPAN that can do this easier, set the HTTP
> headers automaticly... but I couldn't find such a thing.
>
> Do you know if there is such a module available, or I would need to
> write my own?
>
> Thank you.
>
> Octavian
>

Have you looked at Net::FTP ? It is a standard module that comes with Perl.
 #3  
08-02-09, 03:50 PM
orasnita
From: "Shawn H. Corey" <shawnhcorey>
> Octavian Râ?ni?? wrote:
> Have you looked at Net::FTP ? It is a standard module that comes with
> Perl.


Yes I know about Net::FTP, but I want to replace an HTTP client that does
file uploads to a certain program on the web server, and not an FTP client
that uploads to an FTP server.

Thanks.

Octavian
 #4  
08-02-09, 05:46 PM
Dermot
2009/8/2 Octavian Râșniță <orasnita>:
> From: "Shawn H. Corey" <shawnhcorey>
>>
>> Octavian Râșniță wrote:
>>>
>>> Hi,
>>>
>>> Due to the file size limitations of the common browsers like IE or
>>> Firefox, I wanted to create a file uploader that doesn't use a browser,but
>>> just posts a file to a program on a server.


I might have the wrong end of the stick here but couldn't you use LWP for this?
Dp.
 #5  
08-02-09, 06:01 PM
Gunnar Hjalmarsson
Octavian Râ?ni?? wrote:
> Due to the file size limitations of the common browsers like IE or
> Firefox, I wanted to create a file uploader that doesn't use a browser,
> but just posts a file to a program on a server.
>
> I've searched for a module on CPAN that can do this easier, set the HTTP
> headers automaticly... but I couldn't find such a thing.


Which browser related file size limitations are you talking about?
CGI.pm or CGI::UploadEasy allows you to set the max size to whatever
value you wish.
 #6  
08-02-09, 06:04 PM
orasnita
From: "Dermot" <paikkos>
2009/8/2 Octavian Râșniță <orasnita>:
> From: "Shawn H. Corey" <shawnhcorey>
>>
>> Octavian Râșniță wrote:
>>>
>>> Hi,
>>>
>>> Due to the file size limitations of the common browsers like IE or
>>> Firefox, I wanted to create a file uploader that doesn't use a browser,
>>> but
>>> just posts a file to a program on a server.


> I might have the wrong end of the stick here but couldn't you use LWP for
> this?
> Dp.


Oh yes I can, but it seems that I am missing something and the uploader
doesn't work.

I have tried:

use strict;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new;

#The boundary:
my $hash = "------xx9859x" . time();

my $req = HTTP::Request->new(POST => 'http://www.site.com/upload');
$req->content_type("multipart/form-data; boundary=$hash");

my $file_content = <<EOF;
$hash
Content-Disposition: form-data; name="file"; filename="E:\\filename.txt"
Content-Type: text/plain

The body of the text file
$hash
EOF

$req->content($file_content);

my $res = $ua->request($req);

__END__

The html form that uploads the files has an action of "/upload" and the
field name of the "file" field is "file".

But nothing is uploaded.

Thanks.

Octavian
 #7  
08-02-09, 06:42 PM
orasnita
From: "Gunnar Hjalmarsson" <noreply>
> Octavian Râ?ni?? wrote:
>> Due to the file size limitations of the common browsers like IE or
>> Firefox, I wanted to create a file uploader that doesn't use a browser,
>> but just posts a file to a program on a server.
>>
>> I've searched for a module on CPAN that can do this easier, set the HTTP
>> headers automaticly... but I couldn't find such a thing.

>
> Which browser related file size limitations are you talking about? CGI.pm
> or CGI::UploadEasy allows you to set the max size to whatever value you
> wish.


I haven't set any upload limit in a script I use for uploading files, but I
couldn't upload more than 130 MB with Firefox and more than 150 MB with
Internet Explorer, even though I tried for more times.
I was told that the browsers have a hard coded file upload limit that can't
be changed, and that the restrictions that the server-side programs can make
is usually used for setting a lower limit.

I was recommended that I shouldn't upload such big files using HTTP, but it
would be an easier solution if it would be possible, and I would like to be
able to use HTTP for uploading files up to 2 GB.

I have also read that this is another reason why there were made some file
upload widgets that use Flash for uploading files.

Well, I don't know what's the real truth, but the fact is that I wasn't able
to upload big files.

Thanks.

Octavian
 #8  
08-04-09, 04:14 AM
Randal L. Schwartz
>>>>> "Octavian" == Octavian Râșniță <orasnita> writes:

Octavian> I was recommended that I shouldn't upload such big files using HTTP,
Octavian> but it would be an easier solution if it would be possible, and I
Octavian> would like to be able to use HTTP for uploading files up to 2 GB.

Apache (rightfully) barfs long before that. Why do you think that you want to
use HTTP for 2GB uploads, especially since you're trying to get the browser
out of the picture?
 #9  
08-04-09, 06:14 AM
Octavian Rasnita
From: "Randal L. Schwartz" <merlyn>
>
> Octavian> I was recommended that I shouldn't upload such big files using
> HTTP,
> Octavian> but it would be an easier solution if it would be possible, and
> I
> Octavian> would like to be able to use HTTP for uploading files up to 2
> GB.
>
> Apache (rightfully) barfs long before that. Why do you think that you
> want to
> use HTTP for 2GB uploads, especially since you're trying to get the
> browser
> out of the picture?
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
> 0095


I don't want to get the browsers out of the picture. I would like to be able
to simply upload a big file using a form with a "file" field using a common
browser, but I have seen that this seems impossible, and I thought that the
browsers are the cause, so I try to find another HTTP-based solution.

But if you say that Apache is the one that cause the problem, can I change
some settings in order to make it able to handle big file uploads?
(Or it has a hard-coded limitation?)

Thanks.

Octavian
 #10  
08-04-09, 06:26 AM
Randal L. Schwartz
>>>>> "Octavian" == Octavian Rasnita <orasnita> writes:

Octavian> But if you say that Apache is the one that cause the problem, can I
Octavian> change some settings in order to make it able to handle big file
Octavian> uploads? (Or it has a hard-coded limitation?)

You don't want to do that. You really don't want to do that.

Use a restartable protocol, like FTP, or rsync. HTTP was not
meant to do this.
Similar Threads
Ajax file uploader

Hi, I'm looking for an ajax file uploader and wondering if such a control exists? Thanks Source: [..]

file uploader script

I'm working with an uploader script and am trying to establish the parent directory to which files will be uploaded. However, after the parent directory is set in the code...

flash/php file uploader

Hi Sorry if this is considered off topic, but do you know of any code examples/libs with a flash/php file uploader with progress bar? I've googled for a while but the...

file uploader

Does anyone know how i can go about getting a file uploader on my FrontPage 03 website.

HTML File Uploader

Hi I have recently developed a few sites with an uploader facility for images and all has worked perfectly, until now??? I re-installed .NET due to an unrelated problem and...


All times are GMT. The time now is 02:54 AM. | Privacy Policy