Permissions Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Areric

    #1

    Permissions Problem

    Hey all, im running php5 on a suse linux box. Im writing a file upload
    script. Currently i can pull the temporary filename out of the post
    data but i cant seem to open that for reading. Its stored in /tmp. Can
    anyone think of a reason why i can upload stuff but not read it once
    its there?

  • Drakazz

    #2
    Re: Permissions Problem

    Because "tmp" means "temporary" , deleted when actually script finishes
    executing.
    If temporary uploaded files would not be deleted, your /tmp would be
    quite big and some webmasters wouldn't like that.

    Comment

    • Andy Jeffries

      #3
      Re: Permissions Problem

      On Mon, 01 May 2006 19:27:48 -0700, Areric wrote:[color=blue]
      > Hey all, im running php5 on a suse linux box. Im writing a file upload
      > script. Currently i can pull the temporary filename out of the post data
      > but i cant seem to open that for reading. Its stored in /tmp. Can anyone
      > think of a reason why i can upload stuff but not read it once its there?[/color]

      Have you got the right "enctype" on the upload form tag? I think it's
      multipart/form-data but I'm not 100% sure (I have a template for it set
      up in gPHPEdit).

      Cheers,


      Andy

      --
      Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
      http://www.gphpedit.org | PHP editor for Gnome 2
      http://www.andyjeffries.co.uk | Personal site and photos

      Comment

      • Areric

        #4
        Re: Permissions Problem

        ya its the right enctype... ive run the same script on a different
        machine with no problems.

        As for the temporary thing, i dont need the file, i need the
        contents... at one point in the script i run imagefromjpeg() on the
        file... when i get to this point its not readable.. its like the file
        deletes well before the script ends.

        Comment

        • Jerry Stuckle

          #5
          Re: Permissions Problem

          Areric wrote:[color=blue]
          > ya its the right enctype... ive run the same script on a different
          > machine with no problems.
          >
          > As for the temporary thing, i dont need the file, i need the
          > contents... at one point in the script i run imagefromjpeg() on the
          > file... when i get to this point its not readable.. its like the file
          > deletes well before the script ends.
          >[/color]

          How about posting your script so we can see what's going on?

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • Areric

            #6
            Re: Permissions Problem

            Ok so i figured something out... APparently its a size issue. I can
            upload any image with a size <= 350 KB but when i hit 351 it fails...
            the weird thing is when it fails in the script is completley
            arbitrary... it will ALWAYS read from the file but if i try and store
            the info into a variable it blows up. Its like php vars have an
            arbitrary hard limit of 350k size.

            By which i mean this outputs the string content of the file
            echo file_get_conten ts($filename);

            but this sequence of events outputs nothing
            $fp = fopen($filename , 'rb');
            $this->SetImageConten t(file_get_cont ents($filename) );
            echo $this->GetImageConten t();
            $this->SetImageSize($ filename);

            Where SetImageContent and GetImageContent are the following
            function GetImageContent ()
            {
            return $this->mImageConten t;
            }
            function SetImageContent ($value)
            {
            $this->mImageConten t = $value;
            }

            and mImageContent is just declared as a normal variable of the class.

            Comment

            • Areric

              #7
              Re: Permissions Problem

              OK i have a bit of insight into the problem. I found a script on the
              php forumns about a memory issue with uploading large images. Seems
              like my memory is getting soaked up by this script. I probably only
              have to do a bit of optimization but i think im breaking that limit.

              Comment

              Working...