BUG: file uploading in SC6

I am using sc6 and made a file upload form named grid_filestorage
So sc makes me a file called grid_filestorage.php

When this file is made directly when I use scriptcase the following is hte beginning of the file:
<?php
//
include_once(‘grid_filestorage_session.php’);
@session_start() ;
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_perfil’] = “”;
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_prod’] = “/scriptcase/prod”;
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_imagens’] = “/scriptcase/file/img”;
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_imag_temp’] = “/scriptcase/tmp”;
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_doc’] = “C:/storage/”;
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_conexao’] = “conn_oracle”;

When this file is created via deployment then this is created:
<?php
//
include_once(‘grid_filestorage_session.php’);
@session_start() ;
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_perfil’] = “conn_oracle”;
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_prod’] = “”;
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_imagens’] = “”;
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_imag_temp’] = “”;
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_doc’] = “”;
//

This is of course totally incorrect!!
This line: $_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_doc’] = “C:/storage/”;
should be the same when deployed as with the direct scriptcase.

I so wish you would fix the bugs in sc6 as well… This is surely another one.

upon investigation I noticed that these lines in the genereated code:
$this->path_prod = $_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_prod’];
$this->path_imagens = $_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_imagens’];
$this->path_imag_temp = $_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_imag_temp’];
$this->path_doc = $_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_doc’];
are coming BEFORE the piece of code for the OnApplicationInit

A bit later on there is this code:
$_SESSION[‘sc_session’][$this->sc_page][‘grid_filestorage’][‘path_doc’] = $this->path_doc;
still with the wrong $this->path_doc

Only about 100 lines lines after that the OnApplicationInit is called.
So the result is basically that whatever I try, it will ALWAYS be set to empty.

Basically because:
1:Line 9 See previous post: the initialisation is WRONG it should be filled!!!
$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_doc’] = “”;

line 273:the generation follows the line
//check doc
if(empty($_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_doc’]))
{
/check doc/$_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_doc’] = $str_path_apl_dir . “_lib/file/doc”;
}

line 285:this line of course then is pointing to my _lib/file/doc of the application I made since it was empty to begin with
$this->path_doc = $_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_doc’];

line 410: since the path is wrong the followinf goes wrong
$_SESSION[‘sc_session’][$this->sc_page][‘grid_filestorage’][‘path_doc’] = $this->path_doc;

line 510 my OnApplicationInit properly replies my application doc path
echo ‘Session path=’ . $_SESSION[‘scriptcase’][‘grid_filestorage’][‘glo_nm_path_doc’] . “<br>”;
and even tho I set it here to be something else it is already to late since it is set at line 410.

So basically the code that is generated is also wrong in that way.
All would be fine if the first lines were to be generated properly. They are NOT tho.
Now if you look carefully you see that the other paths are ALSO not filled in. Meaning it will also fail for example with image fields.

Hence my conclusion that the code generator has a bug.

I use a form with Editable Grid orientation
on it is a FILENAME (Document filename) and a SUBFOLDER as type text which I want to use as the subfolder in which to place my files.
On the Application settings the documents path is c:/storage/ the FILENAME has a subfolder [sc_upload_subfolder] which is properly generated.

So for people that are using sc7, a small warning. This bug may have been propagated into sc7 as well…

Hello rr,

So the issue only happens if you try to use a global variable to set the subfolder in order to upload files?

Issue reported to our bugs team.

regards,
Bernhard Bernsmann

I would store the whole story in your mantis database. This is one of the best documented bugs available. We are changing the uploadfolder, haven’t tried it with a fixed path. But paths are generated empty.

Fixed paths will also fail… Basically the generated code is simply incorrect. And this goes also for any other type of form window I create with the upload document field.
It can be verified quickly. Simply make a form with an upload field, generate and test, then deploy en check the main .php code (not the _apl.php).
Just follow the generated code logic and you’ll quickly verify the bug as I have described.
Interestingly enough on ALL our deployed forms those initilisations in the first called php are empty, always… So I’d say there is proof enough…
The application path settings are simply not in the deployment. The only thing that is set is the database connection.

is anybody noticing this bug, or still in pending :frowning:

I have the same problem, i cannot tell in details like “rr” but my program is not working to upload files in PRODUCTION, SCRIPTCASE PLZ HEEEEELLLLPPPPPP…

or what to do ???

I am not a big programmer so i will not fix something that is broken in the product that i PAY for…

Hello guys,

I will verify the bug status with our team.

regards,
Bernhard Bernsmann

Please Mr. Bartho,

its really need to fix, I am very upset with it, I am using scriptcase since v5 and since that time I couldn’t deliver the image upload application.
thanks…

Please S.O.S fix this problem!!!

So is this ever going to be fixed ???

Problem:


When we upload an image with file-field, the image was uploaded in tmp-directory, but not transferred in image-directory. Result: The image can’t be displayed.

On the local system (WAMP with PHP 5.3) it works.

Environment of the production-server: PHP 5.4 on 1and1-Hosting-Provider

Work-Arround (solution?):

The problem lies in the lack of time zone definition!

We have changed the third-party-Modul “…\scriptcase7\devel\lib hird\blueimp\index.p hp”

Now, we call the “date_default_timezone_set”-function – after the “error_reporting-call”.

for example:
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set(‘Europe/Berlin’); <-------

This index.php is a template for the scriptcase-generation. And now scriptcase generate the code with this date_default_timezone_set-call.

AFTER GENERATION ALL MODULES -> IT WORKS :slight_smile:

I do not know if this solution applies generally. For us, this work-arround works and we will also sent this work-arround to SCRIPTCASE.

this is the final solution, and its working for me,

Environment:
Windows Server 2008
php-v5.2

check out and let us know, if its work for you no no.

regards…

For me worked fine, but i think that SC team must to do this changes for programing, because when upgrade with news SC this line must be with in new code.

I am really disappointed because scriptcase has taken so long and still not fixed this bug. Many developers depend on this feature to run without error. When we paid for the software license, we paid a full amount expecting the software would perform as it must. scirptcase company: Please fix this error or think about compensating your customers it has takenn too long.

Specially since I gave more then enough detail for them to fix this bug… I guess they dont wont ususing SC6 anymore…

@rr
I am using SC7 and same thing still happening. When i check the top few lines of the deployed php file, they are still set to empty values. Please see below. Code generated with SC 7.00.0018

<?php
//
include_once(‘form_test_application_session.php’);
@session_start() ;
$_SESSION[‘scriptcase’][‘form_test_application’][‘glo_nm_perfil’] = “connection123”;
$_SESSION[‘scriptcase’][‘form_test_application’][‘glo_nm_path_prod’] = “”;
$_SESSION[‘scriptcase’][‘form_test_application’][‘glo_nm_path_imagens’] = “”;
$_SESSION[‘scriptcase’][‘form_test_application’][‘glo_nm_path_imag_temp’] = “”;
$_SESSION[‘scriptcase’][‘form_test_application’][‘glo_nm_path_doc’] = “”;
//

I am really having problems with uploading images and not sure it is failing due to the error you mentioned. When try to save a record with images, i get “Upload failed”. Strange thing is this not happening all the time. Please see below for some for information regarding the error i am getting at the below thread.

http://www.scriptcase.net/forum/showthread.php?4375-Image-Upload-Failed&p=16115#post16115

At the time i posted my topic, i didn’t see your thread. today i came across your one, and thinking i might be having the same problem as you.

I still have a problem with SC 8. document save to database but still view on grid and showing broken link. any update for this bug ?

Be aware that you have the paths right. In deployment you have to use advanced deployment and fill in the proper paths and subpaths!! If you dont then your files are placed in a tmp dir,
which gets cleaned and so on. I advise using a seperate dir for that and add the dir and subpaths in the advanced deployment.