CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 FileUpload in dynamic folder

Print topic Send  topic

Author Message
thomas2340

Posts: 55
Posted: 07/20/2014, 9:58 PM

Hi,

i want to put files into a dynamic created directory.

Temporary Folder: temp
File Folder: files/{immo_id}

i put this in the AfterInsert Event:

$immo_id = mysql_insert_id(); // gets last_id
mkdir("/var/www/vhosts/immos/httpdocs/files/$immo_id", 0755);

i put this in the AfterProcessFile Event:

$immo_id = mysql_insert_id();
$src = "/var/www/vhosts/immos/httpdocs/files/*.*";
$dst = "/var/www/vhosts/immos/httpdocs/files/$immo_id";
$command = 'mv ' . $src . ' ' .$dst;
shell_exec("$command");

ccs doesnt exept the fileFolder and without that it works but FileUpload Component looks then to the directroy files instead of files{immod_id} where are no pictures.

Has someone an idea ?
View profile  Send private message
eratech


Posts: 513
Posted: 07/24/2014, 1:12 AM

Hi - without setting up a demo, a couple of places to check:

- does your webserver have permissions to create folders within the site?
- is there a block on running shell_exec() for the webserver?
- check if the $immo_id is being treated literally "$immo_id" or the variable "12345"
(especially in
mkdir("/var/www/vhosts/immos/httpdocs/files/$immo_id", 0755);
- you probably don't need to get '$immo_id = mysql_insert_id();' in both the AfterInsert and AfterProcessFile - try declaring '$immo_db' in the AfterInsert, and then do 'global $immo_db' in the After ProcessFile to pull the variable into scope.
- You may also be able to change the run-time properties for the FileUpload component (for property 'FileFolder' when you have inserted the file and let CCS do the copy/paste for you.
See the example in the Help file that discusses changing the FileFolder per user login.
global $files;  
$files->file->FileFolder = "/www/files/" . CCGetUserLogin() . "/";  

Cheers

E
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.