fix move_uploaded_file errors

This commit is contained in:
Evgeny Gryaznov 2013-03-04 23:57:42 +01:00
parent dd6632ffdf
commit c50d60730c
3 changed files with 21 additions and 22 deletions

View File

@ -3,27 +3,26 @@
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<ADDITIONAL_INDENT_OPTIONS fileType="sass">
<option name="INDENT_SIZE" value="2" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="yml">
<option name="INDENT_SIZE" value="2" />
</ADDITIONAL_INDENT_OPTIONS>
<codeStyleSettings language="JavaScript">
<indentOptions>
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<codeStyleSettings language="PHP">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>

View File

@ -713,7 +713,7 @@ function print_csrf_token_input()
{
setcsrftoken();
echo "<input name='csrf_token' type='hidden' value='" . $_SESSION['csrf_token'] . "' />";
echo "<input name='csrf_token' type='hidden' value='" . $_SESSION['csrf_token'] . "' />\n";
}
/* print csrf token in url format */

View File

@ -45,7 +45,7 @@ if (!$op) {
$errors[] = getlocal('page_agent.cannot_modify');
} else if (isset($_FILES['avatarFile']) && $_FILES['avatarFile']['name']) {
$valid_types = array("gif", "jpg", "png", "tif");
$valid_types = array("gif", "jpg", "png", "tif", "jpeg");
$orig_filename = $_FILES['avatarFile']['name'];
$tmp_file_name = $_FILES['avatarFile']['tmp_name'];
@ -65,7 +65,7 @@ if (!$op) {
if (file_exists($full_file_path)) {
unlink($full_file_path);
}
if (!move_uploaded_file($_FILES['avatarFile']['tmp_name'], $full_file_path)) {
if (!@move_uploaded_file($_FILES['avatarFile']['tmp_name'], $full_file_path)) {
$errors[] = failed_uploading_file($orig_filename, "errors.file.move.error");
} else {
$avatar = "$webimroot/images/avatar/$new_file_name";