CGI file upload script problems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • owz2008
    New Member
    • Jun 2008
    • 14

    #16
    I think we're getting somewhere now..

    i put the code in and replaced the paths, but I now get the error

    Software error:

    Can't open </public_html/canvasimages/louise_h_pic.jp g> : No such file or directory at upload.cgi line 39.

    The file paths for the upload are not right. But im unsure of the convention..

    On the ftp where i upload my site there sits the cgi - bin, public_html, cgi-data and logs, the directory canvasimages is where I want the uploaded image to go to. this is stored in directly in the public_html directory so I'm guessing that the file path would be:

    "/public_html/canvasimages/image.jpg"

    am I right in thinking that?

    Comment

    • owz2008
      New Member
      • Jun 2008
      • 14

      #17
      I've also noticed that even when I get that last error, I check the canvasimages directory on the ftp and there are no images stored. ??

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #18
        generally there is more path data before the public_html folder, it is something like:

        home/user/public_html

        where user is your unique ID on the server, but there coul dbe more folders too, like on one server I rent the path to the public_html folder is:

        /home/users/web/****/ipw.e-pixsco/public_html

        run this script on your server:

        Code:
        #!/usr/bin/perl 
        print "Content-type: text/html\n\n"; 
        foreach $key (sort keys(%ENV)) {
              printf("<font color=red>%-10.20s:</font> <font color=blue><b>$ENV{$key}</b></font><br>", $key);
           }
        exit;
        It will display the ENV details of the server, the one named DOCUMENT_ROOT will be the full path to the public_html folder.

        Comment

        • owz2008
          New Member
          • Jun 2008
          • 14

          #19
          Hi Kev, I tried that script but i got the following:

          Internal Server Error

          The server encountered an internal error or misconfiguratio n and was unable to complete your request.
          Please contact the server administrator, webmaster@icomw orks.co.uk and inform them of the time the error occurred, and anything you might have done that may have caused the error.

          More information about this error may be available in the server error log.

          I'm gonna have the word with the server administrator when he's in and see what he can do..

          I have saved your script you did on notepad on a p.c and put it on the server, then I just typed the url to that script...

          I made sure all the permissions were set to 755 but no luck

          Im confused by this last error because I thought I was getting somewhere with my script but getting that error message on your script makes me think i'm doing something wrong my end...

          Comment

          • owz2008
            New Member
            • Jun 2008
            • 14

            #20
            it might be worth me emailing you my script file and you can then tell me if the script is saved in the correct format... ?

            Comment

            • KevinADC
              Recognized Expert Specialist
              • Jan 2007
              • 4092

              #21
              Originally posted by owz2008
              it might be worth me emailing you my script file and you can then tell me if the script is saved in the correct format... ?
              Your script appears to be working, just the path to the public_html folder needs to be worked out. The script I posted for you to try should work, if it does not then you need to make sure to upload in ASCII (text) mode. That is different than the format you save the file in. See your FTP programs help files for "transfer mode" or similar.

              Comment

              • owz2008
                New Member
                • Jun 2008
                • 14

                #22
                Hello again Kevin, I looked up how to upload in ascii format and it looks like I was uploading in ascii format all along, so thats not the issue,

                I've decided to get a new script as I got fed up trying to debug the old one, but I'm now having problems with this news script...

                I downloaded the file uploader script from www.mycgiscript s.com/file-uploader.html

                theres two parts that have stumped me, this script now emails the user/admin to let them know that the upload has been successful, there is a few lines on the cg i script which are asking me for either my sendmail or an smtp address,

                I checked with the newtwork admin and he said we do not use smtp, we use exchange to run our email system. here is the email lines in the script

                #Mailing. Send emails to admin/user via smtp or sendmail? Set only one!

                $sendmail="owai n@icomworks.co. uk";
                $smtp="";

                would this be the correct format?

                Comment

                • KevinADC
                  Recognized Expert Specialist
                  • Jan 2007
                  • 4092

                  #23
                  this line:

                  $sendmail="owai n@icomworks.co. uk";

                  should be:

                  $sendmail="owai n\@icomworks.co .uk";

                  or use single-quotes so the @ symbol is not interpreted as an array and expanded into a string because of the double-quotes:

                  $sendmail='owai n@icomworks.co. uk';

                  Comment

                  • owz2008
                    New Member
                    • Jun 2008
                    • 14

                    #24
                    Thanks Kevin, Iv'e done that. Not sure if it works yet as I'm still having trouble submitting the form..

                    I now seem to get the error "Error : Cannot upload file 1215417988-1jpg: Permission denied"

                    The file name is paypal.jpg is it normal for the files to be uploaded as different names?

                    I have checked the permissions on the uploadfolder, the script folder and the .cgi script, but it still produces this error?

                    any ideas why?

                    Comment

                    • KevinADC
                      Recognized Expert Specialist
                      • Jan 2007
                      • 4092

                      #25
                      make sure the folder you are uploading to has read/write permissions. That should be 644. You can check the folders permissions using an FTP program or your websites control panel, if there is one.

                      Comment

                      Working...