Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-25 15:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found