This topic is locked

fileupload to variable locations

9/13/2006 12:27:55 AM
PHPRunner General questions
rjks author

Morning,
I am trying to upload files, in this case images to variable locations.
In the formatting table (7 from 12) i can set edit as field to document upload and define a path
i.e ../bilder/
this is fine as a base directory but I wish to store the images in directorys which define from whre they come.
This is an exanple of what I´ve managed to do, for the upload it works bit not for the view.
I change the function GetUpöoadFolder in _functions :

function GetUploadFolder($field,$table)

{

$path="";

##ALLFIELDS## if($field=="##FIELD##") $path="##UPLOADFOLDER##";

##/ALLFIELDS##

if(strlen($path) && substr($path,strlen($path)-1) != "/")

$path.="/";

if ($table == "acc_einheit"){

$path.= $_SESSION["acc_objekt_masterkey"]."/".$_SESSION["acc_einheit_masterkey"]."/";

}

if ($table == "acc_objekt"){

$path.= $_SESSION["acc_objekt_masterkey"]."/".$_SESSION["acc_einheit_masterkey"]."/";

}



return $path;

}


This is just an example of what I need.
Objekt number 496

Einheit number 3
which gives me the directory path for images from the above Objekt and Einheit
../bilder/496/3/haus2.jpg
The file is then uploaded but only if the directory already exists!
Now to my Questions:

  1. Where can I set the path for viewing the images I upload as shown above.
  2. Why insn´t the directory created automatically as stated in the Thumb Tutorial, all rights are set on the webserver.
    Thanks in advance
    Robert

J
Jane 9/13/2006

Robert,
please see my answers below:

  1. function GetUploadFolder is defined for EDIT and LIST pages. You don't need to set path to view upload files.
  2. Folder for upload files is created when you build your project.

    If you make changes in the files or in the templates directory won't be created automatically.