upload-Mod: wie kann ich CHMOD definieren
Verfasst: 26.10.2005 23:41
Hallo,
Ich habe in meinem Forum ein upload-Mod installiert. Dieser lädt die Dateien schön rauf, aber die Files können danach nicht heruntergeladen werden, weil CHMOD auf 600 gestellt ist.
gibt es ein PHP Befehl mit dem man CHMOD beispeilsweise auf 644 stellen kann?
Auszug aus dem Skript:
//tests if the user already has a folder for his files (if not, will create one)
if( !file_exists($phpbb_upload_path . $userdata['user_id']) )
{
mkdir($phpbb_upload_path . $userdata['user_id']);
$index_file =
'<?
header("Location:../../");
?>';
$file_handle = fopen($phpbb_root_path . $phpbb_upload_path . $userdata['user_id'] . '/index.' . $phpEx, 'w');
fwrite($file_handle, $index_file);
fclose($file_handle);
}
//Checks, if this file has already been uploaded
if( file_exists($phpbb_upload_path . $userdata['user_id'] . '/' . $HTTP_POST_FILES['file']['name']) )
{
$warning = true;
$upload_msg = $lang['Upload_already_exists'];
}
//If everything is ok, the file will be moved into the destination folder and the data will be written into the database
else
{
$hidden = ( isset($HTTP_POST_VARS['public']) ) ? 0 : 1;
$sql = "INSERT INTO " . UPLOAD_FILES_TABLE . " (username, user_id, filename, filesize, last_modified, hidden) VALUES ('" . $userdata['username'] . "', '" . $userdata['user_id'] . "', '" . $HTTP_POST_FILES['file']['name'] . "', '" . ($HTTP_POST_FILES['file']['size'] / 1000) . "', '" . time() . "', '" . $hidden . "')";
if( $db->sql_query($sql) )
{
$moved = move_uploaded_file($HTTP_POST_FILES['file']['tmp_name'], $phpbb_upload_path . $userdata['user_id'] . '/' . $HTTP_POST_FILES['file']['name']);
if( $moved != true )
{
$warning = true;
$upload_msg = $lang['Upload_error_transfer'];
}
else
{
header("Location:upload.php");
}
}
else
{
message_die(CRITICAL_ERROR, "Could not save upload information to the database", "", __LINE__, __FILE__, $sql);
}
}
Ich kenne mich nicht so gut aus, aber ich glaube, dass hier das File gespeichert wird... kann ich da nun irgendwie definieren, dass mein file lesbar für alle ist?
Danke für eure Hilfe.
es
Ich habe in meinem Forum ein upload-Mod installiert. Dieser lädt die Dateien schön rauf, aber die Files können danach nicht heruntergeladen werden, weil CHMOD auf 600 gestellt ist.
gibt es ein PHP Befehl mit dem man CHMOD beispeilsweise auf 644 stellen kann?
Auszug aus dem Skript:
//tests if the user already has a folder for his files (if not, will create one)
if( !file_exists($phpbb_upload_path . $userdata['user_id']) )
{
mkdir($phpbb_upload_path . $userdata['user_id']);
$index_file =
'<?
header("Location:../../");
?>';
$file_handle = fopen($phpbb_root_path . $phpbb_upload_path . $userdata['user_id'] . '/index.' . $phpEx, 'w');
fwrite($file_handle, $index_file);
fclose($file_handle);
}
//Checks, if this file has already been uploaded
if( file_exists($phpbb_upload_path . $userdata['user_id'] . '/' . $HTTP_POST_FILES['file']['name']) )
{
$warning = true;
$upload_msg = $lang['Upload_already_exists'];
}
//If everything is ok, the file will be moved into the destination folder and the data will be written into the database
else
{
$hidden = ( isset($HTTP_POST_VARS['public']) ) ? 0 : 1;
$sql = "INSERT INTO " . UPLOAD_FILES_TABLE . " (username, user_id, filename, filesize, last_modified, hidden) VALUES ('" . $userdata['username'] . "', '" . $userdata['user_id'] . "', '" . $HTTP_POST_FILES['file']['name'] . "', '" . ($HTTP_POST_FILES['file']['size'] / 1000) . "', '" . time() . "', '" . $hidden . "')";
if( $db->sql_query($sql) )
{
$moved = move_uploaded_file($HTTP_POST_FILES['file']['tmp_name'], $phpbb_upload_path . $userdata['user_id'] . '/' . $HTTP_POST_FILES['file']['name']);
if( $moved != true )
{
$warning = true;
$upload_msg = $lang['Upload_error_transfer'];
}
else
{
header("Location:upload.php");
}
}
else
{
message_die(CRITICAL_ERROR, "Could not save upload information to the database", "", __LINE__, __FILE__, $sql);
}
}
Ich kenne mich nicht so gut aus, aber ich glaube, dass hier das File gespeichert wird... kann ich da nun irgendwie definieren, dass mein file lesbar für alle ist?
Danke für eure Hilfe.
es