Hi,

I am trying (very hard) to create a page where users of my site can upload there own photos, I have a few books on perl and CGI's to help me. I have managed to get a normal form to work fine and email to me, so I assume I have all the necessary things to make an upload page.

I have used the tutorial out of the book this is my form

<html><head><title>Uploading Files</title></head><body> <form action="/cgi-bin/uploading.cgi"method="post" enctype="multipart/ +form-data"> What file would you like to upload <input type="file"name="uploadfile"size="30"> <input type="submit"> </form></body></html>
This page works ( I think) it will allow me to browse my hard drive and select a file to upload.

The script I have done so far should do no more than print a page saying you have selected to upload xxxx file ( I got stuck at stage 2 and there are loads more stages to go before I am finished)

I then press submit and get a local 500 error, I had these when I first started my email form and it turned out that my permissions were wrong, I have checked these and the script is set to 755 and the cgi bin is set to 755, I assume this is correct. Should I have another folder I made one called uploads but it is in no way linked to this script, Or should I download a copy of CGI.PM if so to where and how do I reference to it in my program

This is my script

#!/usr/bin/perl use CGI::Carp 'fatalsToBrowser'; use strict use CGI ':standard'; print "content-type:text/html\n\n"; my $file=param('uploadfile'); if ($file) { print "<p>you want to upload <b>$file</b>"; } else { print "No file chosen"; } print '</body></html>';

it is called uploading.cgi and I have linked it from my form the same way as I have linked my form that works. The only difference is the use strict and use cgi standard. I have included use CGI::Carp 'fatalsToBrowser'; as I found this in another reply on a forum, however it didn't change anything for me.

I have a feeling and I may be way off base here it is something to do with CGI pm and perl 5, I don't have these on my bit of the server, but if I go up into the admin side I see that it is there, I thought this would mean I have access to it as this is what happened in my perl form that works. Do I have to link there some how, if so how I have looked everywhere about this PM and perl LIB to be honest I really don't understand it, I am willing to download it to my site if needs be, as long as that means I don't have to be connected for my form to work for others and if someone tells me where to put it (politely)

Please help me any and all suggestions are greatly received,

If you need further information on anything let me know, and i will post it. I have posted a lot as I don't know what is relevant and what is not to solve my problem

Edit: Added <code> tags. Minor formattings. larsen


In reply to Cgi pm and photo uploads by julieowen24

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.