Jump to content

Image Upload chmod Help


datoshway

Recommended Posts

This is my upload script and I just switched servers and their server is defaulting to 600, need some help on how to integrate a chmod into this. 

 

<?php

$arrDataExtra			= array("dtEntered" => date(STR_SQL_DATE_FORMAT));
$arrDataArray			= array("strName" => "", 
								"txtDetails" => "");

prepVariables($_POST);

$arrDataArray			= buildDataArray($arrDataArray);
$strQuery				= db_auto_query(INT_QUERY_INSERT, "tblNews", $arrDataArray, array(), $arrDataExtra, false);

db_query($strQuery);

$intContentID			= db_insert_id();

if ($intContentID > -1) {
	$strProductPath		= STR_UPLOADS_PATH . $intContentID . "/";

	if (!file_exists($strProductPath)) {
		@mkdir($strProductPath);
		@mkdir($strProductPath . "_thumbs/");
	}

	// upload image
	if (($_FILES['filImage']['error'] == UPLOAD_ERR_OK) && ($_FILES['filImage']['error'] != UPLOAD_ERR_NO_FILE)) {
		$arrPathInfo			= pathinfo($_FILES['filImage']['name']);
		$strFilename			= uniqid(rand(), true) . "." . strtolower($arrPathInfo['extension']);
		move_uploaded_file($_FILES['filImage']['tmp_name'], $strProductPath . $strFilename);

		// thumb
		resizePhoto(88, $strProductPath . $strFilename);

		// update record
		$strQuery				= sprintf(	"UPDATE tblNews SET strFilename = '%s' WHERE intID = %d", 
											addslashes($strFilename), 
											intval($intContentID));
		db_query($strQuery);
	}

	$strSuccess				= "Successfully added that news!";
} else {
	$strProblem				= "There was a problem encountered while trying to add that news.  Please try again.";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/202193-image-upload-chmod-help/
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.