Jump to content

Small Joomla Prob


forumnz

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.