Jump to content

Recommended Posts

Hey, I want to upload images via the Joomla media manager. Prob is that it uploads with CHMOD 0600 and can't display properly with a mod I have. I want to be able to upload with 0644.

 

I have found the possible source but I dont know what to do with it. I believe I should add , 0644 somewhere.

 

Can someone please help?

 

Sam.

 

function upload() {
if (isset($_FILES['upload']) && is_array($_FILES['upload']) && isset($_POST['dirPath'])) {
	$dirPathPost 	= $_POST['dirPath'];
	$file 			= $_FILES['upload'];

	if (strlen($dirPathPost) > 0) {
		if (substr($dirPathPost,0,1) == '/') {
			$IMG_ROOT .= $dirPathPost;
		} else {
			$IMG_ROOT = $dirPathPost;
		}
	}

	if (strrpos( $IMG_ROOT, '/' ) != strlen( $IMG_ROOT )-1) {
		$IMG_ROOT .= '/';
	}

	do_upload( $file, COM_MEDIA_BASE . $dirPathPost . '/');
}
}

Link to comment
https://forums.phpfreaks.com/topic/70111-small-joomla-prob/
Share on other sites

Thanks,

 

why won't the following work?

 

function upload() {
if (isset($_FILES['upload']) && is_array($_FILES['upload']) && isset($_POST['dirPath'])) {
	$dirPathPost 	= $_POST['dirPath'];
	$file 			= $_FILES['upload'];

	if (strlen($dirPathPost) > 0) {
		if (substr($dirPathPost,0,1) == '/') {
			$IMG_ROOT .= $dirPathPost;
		} else {
			$IMG_ROOT = $dirPathPost;
		}
	}

	if (strrpos( $IMG_ROOT, '/' ) != strlen( $IMG_ROOT )-1) {
		$IMG_ROOT .= '/';
	}

	do_upload( $file, COM_MEDIA_BASE . $dirPathPost . '/');
	chmod(COM_MEDIA_BASE . $dirPathPost . '/', 0644);

}
}

 

Note the extra:

chmod(COM_MEDIA_BASE . $dirPathPost . '/', 0644);

Link to comment
https://forums.phpfreaks.com/topic/70111-small-joomla-prob/#findComment-352559
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.