I mentioned some serious error already in version 6 in the uploads. Wand law and behold the exact same bugs are in 7.
I create a form called form_SCRIPTCASE_SC_UPLOAD with a database field called FILENAME, thus a form_SCRIPTCASE_SC_UPLOAD.php is generated.
This form is a single record form.
This generated file then has the following code in the first lines:
<?php
//
include_once('form_SCRIPTCASE_SC_UPLOAD_session.php');
@session_start() ;
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_perfil'] = "conn_oracle";
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_prod'] = "";
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_imagens'] = "";
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_imag_temp'] = "";
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_doc'] = "";
//
further on on line 273 in my case the following code is generated this code basically says if the upload path is empty (which is always): since I can not set glo_nm_path_doc, it is created in the first lines with no setting possibility. So it is always pointing to the _lib/file/doc path
//check doc
if(empty($_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_doc']))
{
/*check doc*/$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_doc'] = $str_path_apl_dir . "_lib/file/doc";
}
Around line 285 we see this:
$this->path_prod = $_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_prod'];
$this->path_imagens = $_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_imagens'];
$this->path_imag_temp = $_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_imag_temp'];
$this->path_doc = $_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_doc'];
if (!isset($_SESSION['scriptcase']['str_lang']) || empty($_SESSION['scriptcase']['str_lang']))
So here $this->path_doc is set to what is determined on line 273, hence it is set to $str_path_apl_dir . “_lib/file/doc”
On line 451 the following code is generated.
Here the
$_SESSION['sc_session'][$this->sc_page]['form_SCRIPTCASE_SC_UPLOAD']['path_doc'] = $this->path_doc;
$_SESSION['scriptcase']['nm_path_prod'] = $this->root . $this->path_prod . "/";
$_SESSION['scriptcase']['nm_root_cep'] = $this->root;
$_SESSION['scriptcase']['nm_path_cep'] = $this->path_cep;
Here $_SESSION[‘sc_session’][$this->sc_page][‘form_SCRIPTCASE_SC_UPLOAD’][‘path_doc’] is also pointing to $str_path_apl_dir . “_lib/file/doc”
Then on line 549 is my OnApplicationInit:
if (isset($_SESSION['sc_session'][$this->sc_page]['form_SCRIPTCASE_SC_UPLOAD']['initialize']) && $_SESSION['sc_session'][$this->sc_page]['form_SCRIPTCASE_SC_UPLOAD']['initialize'])
{
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['contr_erro'] = 'on';
echo "OnApplicationInit";
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['contr_erro'] = 'off';
$_SESSION['sc_session'][$this->sc_page]['form_SCRIPTCASE_SC_UPLOAD']['initialize'] = false;
}
So basically $_SESSION[‘sc_session’][$this->sc_page][‘form_SCRIPTCASE_SC_UPLOAD’][‘path_doc’] variable and $this->path_doc variable have already been set the _lib/… dir.
But I want it to point to MY dir, e.g. c:/documentstorage
In order to be able to do that properly all I can do is set:
$_SESSION[‘sc_session’][$this->sc_page][‘form_SCRIPTCASE_SC_UPLOAD’][‘path_doc’] and $this->path_doc in my OnApplicationInit code in order to have the file uploader work as I want it.
So for example I would want $_SESSION[‘scriptcase’][‘form_SCRIPTCASE_SC_UPLOAD’][‘glo_nm_path_doc’] = “c:/documentstorage”;
This still looks like a serious bug that was never fixed even tho I gave all the details already in version 6.
There are various ways to fix this on YOUR side:
Solution 1: introduce a way to set the variables in the first line, e.g. by setting it somewhere in the app constants and then initialising with it.
Solution 2: have the section of line 285 NOT occur before the OnApplicationInit place (line 549) so either move OnApplicationInit forward or that code around line 285 after the OnApplicationInit
Solution 3: introduce a path setting with the document file type that can override the settings and have it set in the beginning of the code when it is generated. So the first lines would become:
<?php
//
include_once('form_SCRIPTCASE_SC_UPLOAD_session.php');
@session_start() ;
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_perfil'] = "conn_oracle";
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_prod'] = "";
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_imagens'] = "";
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_imag_temp'] = "";
$_SESSION['scriptcase']['form_SCRIPTCASE_SC_UPLOAD']['glo_nm_path_doc'] = "c:/documentstorage";
//
I have included the generated file so that you can easily see that I am right in this.
please fix this bug so that I can easily change a path when needed!!
We are paying enough money for this to have it fixed and I bet that I am not the only one that has this issue.
form_SCRIPTCASE_SC_UPLOAD.zip (15.6 KB)