This topic is locked
[SOLVED]

 Creating Folders to Upload Images into

7/14/2018 3:04:45 AM
PHPRunner General questions
W
wypman author

I am creating a database for uploading images. I would like to upload the images into a predefined folder based upon date. In the events tab I had added the following code to the Add page -> Before record added.



$folder = "files/";
$directory = date("Y").'/'.date("m").'/'.date("d").'/';

$folder .= $directory;



//If the directory doesn't already exists.

if(!is_dir($directory)){

//Create our directory.

mkdir($directory, 755, true);

}
$_SESSION["Folder"] = $folder;
return true;


In the editor tab, upload folder, I have created following php code:

$folder = $_SESSION["Folder"];


For some reason it doesn't always save data into this folder and places it in the root of the database folder. I am running PHPRunner 9.8. Am I missing something?

HJB 7/14/2018



I am creating a database for uploading images. I would like to upload the images into a predefined folder based upon date. In the events tab I had added the following code to the Add page -> Before record added.



$folder = "files/";
$directory = date("Y").'/'.date("m").'/'.date("d").'/';

$folder .= $directory;
//If the directory doesn't already exists.

if(!is_dir($directory)){

//Create our directory.

mkdir($directory, 755, true);

}
$_SESSION["Folder"] = $folder;
return true;


In the editor tab, upload folder, I have created following php code:

$folder = $_SESSION["Folder"];


For some reason it doesn't always save data into this folder and places it in the root of the database folder. I am running PHPRunner 9.8. Am I missing something?


https://xlinesoft.com/docmanager
Is what you are missing...

admin 7/16/2018

You need to move your code to "Add page: BeforeProcess" event. BeforeAdd event happens after files are uploaded tot he server.

W
wypman author 7/21/2018



You need to move your code to "Add page: BeforeProcess" event. BeforeAdd event happens after files are uploaded tot he server.


That worked! Thanks