Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing an upload script without the CGI.pm library. 1

Status
Not open for further replies.

maff500

Programmer
Jan 10, 2005
14
GB
My problem is that I have a free hosting service, which allows the use of Perl CGI, but it does not seem to be possible to use the CGI.pm library files. Instead, the site provides you with alternative library files.

I need to write a script which uploads a picture file into a folder of my subdomain, and all the scripts which do this require CGI.pm's upload() function. I, of course have no access to this function and the alternative library file that the hosting company gives lack such a function.

How can I get round this problem, and write a script which uploads a picture without use of CGI.pm?

Many thanks in advance.
 
You may be able to upload the CGI.pm file into the same directory as your script and be able to use it (I've never had to do this but I hear it should work).

I'm a little surprised your host doesn't have CGI.pm available as I thought it was a pretty standard package. Are you sure they don't have it?

 
I have tried to upload it to the same directory, but the CGI.pm file seems to use other .pm files, and it's too complicated... I think it's something that the hosting company needs to do, and I cannot.
I am absolutely sure that they don't have it. Bear in mind it is a free hosting service, Lycos' Tripod by the way.
It would be good if i could find a way of writing an upload script without relying on CGI.pm.
Thanks for your help.
 
Yes, I don't believe cgi.pm is a package you can install yourself because of all the dependencies on other modules. I'd ask them to install it if it's not already there or upload a test script to ensure cgi.pm isn't already installed.
 
2 paths to learn cgi
1. google: cgi multipart form
2. PERL: write a (brief) CGI.pm script. Execute it from command line - see the cgi. e.g.:

perl -e "use CGI qw/:standard /; print start_multipart_form;"
 
Ok, I just signed up for a Tripod account and did some poking around. It appears as though CGI.pm is not allowed by default but they give you the option of uploading it to your directory. From the Tripod main page, on the orange menu bar choose "My account" then choose "Website details". At the bottom of that page, choose "Add and edit CGI Scripts". Then click the "Upload" button. Then I believe you can use CGI.pm as well as the other libraries they have provided.

 
Thank you, philote, for doing that, but the CGI.pm that it uploads into your cg-bin doesn't have the upload() function.

madcgimonk, It is a free hosting service and they do not supply a means of contacting them, so I do not feel it is possible to get them to get CGI.pm running for me.

arn0ld, I have no idea what you mean!
 
<disclaimer>I've only had a quick look, so I might have missed something</disclaimer>

From a quick look through CGI.pm (my installed version is 3.04), it seems that it only relies on Carp and CGI::Util, neither of which appear to have any further dependencies, so it shouldn't be all that difficult to install.

It would definitely be preferable to get CGI.pm working than to try and write your own upload code.
 
Tripod's using version 2.30 of CGI.pm and the upload function has only been available since 2.47. I've been messing with uploading files for a bit now and can't get it to work in Tripod. I've also searched and others have claimed to have done this but I have not found any example scripts. It's quite possible they just don't allow file uploads and have taken measures to prevent them.

 
IIRC, Version 3.0 is the version that patches against Cross Site Scripting, so you'd have a legitimate case to get them to upgrade, unless of course they patched their own version of 2.30

You could follow ishnid's lead and install CGI.pm locally along with CGI::Carp, and CGI::Util

--Paul

cigless ...
 
I tried uploading CGI.pm and when I run the script it complains about not finding 'lib.pm' in @INC. I also tried using the script that's used in Tripod's file management but it requires you to be logged in for it to work.

I'm still betting they've taken preventative measures to keep people from uploading files.

 
in this case,why do you need CGI.pm?

why not insert the corresponding html into your script?
 
Ok thanks everyone!

Maybe philote is right and Tripod have tried to make it impossible to upload files.

So I guess the next step is to get another free service for hosting Perl scripts, but which allows the use of CGI.pm.

Does such a service exist (my searching seems to suggest not)?
 

20MB diskspace
250MB monthly bandwidth allowance*
Host up to 5 domains
Multiple FTP access
Access to our web administration ControlCentre
Nameserver access
20 POP3/FTP Clients
Unlimited email aliases
Unlimited email forwarding
Full CGI-Bin access
Unique IP Address
Online (ITS) Support
BUT

No ApacheSSL, PHP, MySQL, SSH or shell access.
No telephone support (Support is available via email and within the ControlCentre)

HTH
--Paul


cigless ...
 
Excellent, Paul!
I shall sign up and try again there, thank you
 
It requires you to be part of a web design group...

The VS20 free web hosting service is only available as a starter package to commercial web designers, developers and resellers on a one-per-organisation basis. ***VS20s are not available as free hosting for private individuals or for companies not involved in the commercial development of the Internet, all such applications will be rejected.***

And so I cannot apply.
 
Remember any sites you develop, you'll hopefully resell, and they're potentially losing out on the sale. If you're interested in creating websites, and selling them, then you're a commercial web developer.

This is where creativity comes into it's own. I'm not advocating the use of untruths, merely using the language to make the most of what you've got. The only potential pit of despair is supplying the URL for qualification. As a sole trader you can still be an entity (albeit one that doesn't sell fish ;))

If you've got a potential client, you could get them to pay for webspace until the website is ready to run

HTH
--Paul

cigless ...
 
for my info:
a. your present ISP allows you to upload and store files from a client/user?

b. you can install a PERL CGI application in your ISP cgi-bin?

c. the file upload HTML can be inserted into your web page(s)?

d. you require CGI.pm for other reasons than upload?
 
There's a huge list of free hosts [link]here[/url] so you should be able to find something you want there.

It looks like tripod have seriously stripped down their perl environment. lib.pm is an even more basic necessity than CGI.pm and is automatically installed with every perl installation. You can still get around it though ;) Lay out your script like this:
Code:
#!/usr/bin/perl 
BEGIN {
   unshift @INC, '/path/to/modules/directory';
}
use CGI;

# rest of the script

That's almost the same as doing:
Code:
use lib '/path/to/modules/directory';
 
ok great.
could you try to post the url to the link

"...of free hosts [link]here[/url] so you ..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top