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"> <component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS"> <option name="PER_PROJECT_SETTINGS">
<value> <value>
<XML> <option name="OTHER_INDENT_OPTIONS">
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" /> <value>
</XML> <option name="INDENT_SIZE" value="4" />
<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="CONTINUATION_INDENT_SIZE" value="8" /> <option name="CONTINUATION_INDENT_SIZE" value="8" />
</indentOptions> <option name="TAB_SIZE" value="4" />
</codeStyleSettings> <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"> <codeStyleSettings language="PHP">
<indentOptions> <indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="8" /> <option name="USE_TAB_CHARACTER" value="true" />
</indentOptions> </indentOptions>
</codeStyleSettings> </codeStyleSettings>
</value> </value>
</option> </option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component> </component>
</project> </project>

View File

@ -713,7 +713,7 @@ function print_csrf_token_input()
{ {
setcsrftoken(); 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 */ /* print csrf token in url format */

View File

@ -45,7 +45,7 @@ if (!$op) {
$errors[] = getlocal('page_agent.cannot_modify'); $errors[] = getlocal('page_agent.cannot_modify');
} else if (isset($_FILES['avatarFile']) && $_FILES['avatarFile']['name']) { } 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']; $orig_filename = $_FILES['avatarFile']['name'];
$tmp_file_name = $_FILES['avatarFile']['tmp_name']; $tmp_file_name = $_FILES['avatarFile']['tmp_name'];
@ -65,7 +65,7 @@ if (!$op) {
if (file_exists($full_file_path)) { if (file_exists($full_file_path)) {
unlink($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"); $errors[] = failed_uploading_file($orig_filename, "errors.file.move.error");
} else { } else {
$avatar = "$webimroot/images/avatar/$new_file_name"; $avatar = "$webimroot/images/avatar/$new_file_name";