summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202017-08-10 10:40:47 +0530
committerGitHub2017-08-10 10:40:47 +0530
commit22d1cea4808711b4bf38bcecbe6b92fefbeb1d96 (patch)
treed26c6ab5872c060bacada831ec99f8c36e4bc07f
parent9063708456604efc0e561285f73804d1c068e876 (diff)
parentc4270187d55aa031da566611417354dde4c53758 (diff)
downloaddwsim_flowsheet-22d1cea4808711b4bf38bcecbe6b92fefbeb1d96.tar.gz
dwsim_flowsheet-22d1cea4808711b4bf38bcecbe6b92fefbeb1d96.tar.bz2
dwsim_flowsheet-22d1cea4808711b4bf38bcecbe6b92fefbeb1d96.zip
Merge pull request #10 from Sashi20/drupal_7.x
Fixed issue of uploading files with same name
-rwxr-xr-xupload_code.inc10
1 files changed, 6 insertions, 4 deletions
diff --git a/upload_code.inc b/upload_code.inc
index 7ad3299..4a2f184 100755
--- a/upload_code.inc
+++ b/upload_code.inc
@@ -1,4 +1,4 @@
-<?php
+ <?php
// $Id$
function dwsim_flowsheet_abstract()
{
@@ -693,7 +693,6 @@ function dwsim_flowsheet_upload_abstract_code_form_submit($form, &$form_state)
if ($proposal_data)
{
$query = "UPDATE {dwsim_flowsheet_proposal} SET
-
dwsim_database_compound_name = :dwsim_database_compound_name
WHERE id = :proposal_id
@@ -745,7 +744,6 @@ function dwsim_flowsheet_upload_abstract_code_form_submit($form, &$form_state)
else
{
$query = "UPDATE {dwsim_flowsheet_submitted_abstracts} SET
-
unit_operations_used_in_dwsim= :unit_operations_used_in_dwsim,
thermodynamic_packages_used= :thermodynamic_packages_used,
logical_blocks_used=:logical_blocks_used,
@@ -842,6 +840,7 @@ function dwsim_flowsheet_upload_abstract_code_form_submit($form, &$form_state)
if (file_exists($root_path . $dest_path . $_FILES['files']['name'][$file_form_name]))
{
//unlink($root_path . $dest_path . $_FILES['files']['name'][$file_form_name]);
+ move_uploaded_file($_FILES['files']['tmp_name'][$file_form_name], $root_path . $dest_path . $_FILES['files']['name'][$file_form_name]);
drupal_set_message(t("File !filename already exists hence overwirtten the exisitng file ", array(
'!filename' => $_FILES['files']['name'][$file_form_name]
)), 'error');
@@ -901,7 +900,9 @@ function dwsim_flowsheet_upload_abstract_code_form_submit($form, &$form_state)
case 'A':
if (file_exists($root_path . $dest_path . $_FILES['files']['name'][$file_form_name]))
{
- //unlink($root_path . $dest_path . $_FILES['files']['name'][$file_form_name]);
+ //unlink($root_path . $dest_path . $_FILES['files']['name'][$file_form_name]);
+ move_uploaded_file($_FILES['files']['tmp_name'][$file_form_name], $root_path . $dest_path . $_FILES['files']['name'][$file_form_name]);
+
drupal_set_message(t("File !filename already exists hence overwirtten the exisitng file ", array(
'!filename' => $_FILES['files']['name'][$file_form_name]
)), 'error');
@@ -964,6 +965,7 @@ function dwsim_flowsheet_upload_abstract_code_form_submit($form, &$form_state)
if (file_exists($root_path . $dest_path_udc . $_FILES['files']['name'][$file_form_name]))
{
unlink($root_path . $dest_path_udc . $_FILES['files']['name'][$file_form_name]);
+ move_uploaded_file($_FILES['files']['tmp_name'][$file_form_name], $root_path . $dest_path . $_FILES['files']['name'][$file_form_name]);
drupal_set_message(t("File !filename already exists directory hence overwirtten the exisitng file ", array(
'!filename' => $_FILES['files']['name'][$file_form_name]
)), 'error');