Permissions Problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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?

Re: Permissions Problem

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

Re: Permissions Problem

On Mon, 01 May 2006 19:27:48 -0700, Areric wrote:
Quoted text here. Click to load it

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).



Andy Jeffries MBCS CITP ZCE   | gPHPEdit Lead Developer | PHP editor for Gnome 2 | Personal site and photos

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.

Re: Permissions Problem

Areric wrote:
Quoted text here. Click to load it

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.

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_contents($filename);

but this sequence of events outputs nothing
$fp = fopen($filename, 'rb');
echo $this->GetImageContent();

Where SetImageContent and GetImageContent are the following
function GetImageContent()
     return $this->mImageContent;
   function SetImageContent($value)
     $this->mImageContent = $value;

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

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.

Site Timeline