Jump to content

chmod code issue


saint

Recommended Posts

Problem: I am trying to add a flash file and it's associated thumbnail.  Every time I do, the thumbnail does not show up properly.  Instead, it _was_ showing the outline of a image that could not be retrieved.  Now, the image doesn't even show up.

 

I have discovered it was a permission problem.  The thumbnail image was chmoded -rw-------.  So the system is trying to retrieve and show that image, but due to the permission, isn't viewable by the public.

 

The following are snippets of code.  I have tried to add in the line to chmod the permission to 0755 just to see if (1) that would bring back the imaged outline again and (2) if it could re-display it properly.  It doesn't work and I have no idea why.  If you can help or need any additional information, please let me know.  Thanks in advance.

 

//uploading primary thumbnails.
if(is_uploaded_file($_FILES["thumb0"]['tmp_name']))
{
$m_image0	= $m_get_max.'0.jpg';					  
$uploaddir	= '../thumbs/';						
move_uploaded_file($_FILES["thumb0"]['tmp_name'],$uploaddir.'/'.$m_image0);	
chmod($uploaddir.'/'.$m_image0, 0755);
}

 

Where... $m_get_max is...

 

//get the maximum number of the user in company add table
$sql_get_max	= "select max(Index_id) as max_no from $table_name_in_db";
$a_get_max	= mysql_fetch_array(mysql_query($sql_get_max));

$m_get_max	= $a_get_max['max_no'];			// maximum no of the table 
$m_get_max++;	//increment by one

Link to comment
Share on other sites

I don't see a problem with your code. so, if the directory has the correct settings and it still doesnt work, try writing a small script to chmod some random file. Does that work?

 

 

Found this on php.net:

 

"Note:

The current user is the user under which PHP runs. It is probably not the same user you use for normal shell or FTP access. The mode can be changed only by user who owns the file on most systems."

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.