paulmason411
Posts: 127
|
Posted: 11/10/2008, 6:37 PM |
|
Hi Guys,
I am trying to create a photo gallery in codecharge. I have set it up so that each of my photo albums has a different folder.
On my FileUpload field for my record form I have the following code:
Before Process File
$Component->FileFolder = mediaFilePath(CCGetParam('album_id'));
Before Show
$Component->FileFolder = mediaFilePath(CCGetParam('album_id'));
The function mediaFilePath simply returns the relevant path for that album.
The file uploads correctly as I've checked the folder and the file is there, however when I try to update the record I get a error messae saying the file can not be found. I thought setting the FileFolder in the before show would fix this.
I think it's basically an issue with setting the FileFolder on the correct process.
Can someone please give this a quick test to see if they get the same problem?
Cheers.
_________________
http://paulmason.name - Web Development Blog
|
|
|
jjrjr1
Posts: 942
|
Posted: 11/11/2008, 6:44 AM |
|
Hi Paul
Actually I think your syntax is incorrect.
Assuming FileFolder is a valid control or component name the correct syntax would be
$Component->FileFolder->SetValue(mediaFilePath(CCGetParam('album_id')));
Have fun
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
|
|
paulmason411
Posts: 127
|
Posted: 11/12/2008, 4:15 AM |
|
Hey John,
I just tried:
$Component->FileFolder->SetValue(mediaFilePath(CCGetParam('album_id')));
and I got the error:
Fatal error: Call to a member function SetValue() on a non-object in C:\Users\paulatop\wamp\www\aircastle_gallery\media_events.php on line 31
So I guess it's a bit different from the usual method?
Do I need to customize the classes.php file that code charge provides? Will this run any risk?
_________________
http://paulmason.name - Web Development Blog
|
|
|
kirchaj
Posts: 215
|
Posted: 11/12/2008, 5:52 AM |
|
Don't know if this will help but this is what I do to set the file folder based on a session variable in the before process file event
$NewRecord1->FileUpload1->FileFolder = "/var/www/html/portfolio/uploads/" . CCGetUserLogin() . "/";
Works perfectly as the folder was created when the user registered.
TK
|
|
|
paulmason411
Posts: 127
|
Posted: 11/12/2008, 3:19 PM |
|
TK,
Are you able to update that file? Because that's where I run into the problem. My original upload goes smoothly.
_________________
http://paulmason.name - Web Development Blog
|
|
|
kirchaj
Posts: 215
|
Posted: 11/13/2008, 6:15 AM |
|
That is a great question.
In our situation, we do not want the file to ever be updated. This is a record of student work and we do not allow the student to update, just upload a new file. I can also administratively remove the file for the student.
Short answer, I don't know if it can be updated or not. I will see if I can test that and get back with you.
TK
|
|
|
paulmason411
Posts: 127
|
Posted: 11/13/2008, 4:41 PM |
|
Okay thanks.
By the way when I say update the file i mean delete and re-upload. I'm unable to delete it as the file can't be found.
_________________
http://paulmason.name - Web Development Blog
|
|
|
girish_327
Posts: 108
|
Posted: 01/15/2009, 7:15 AM |
|
Hello,
I am using dynamic Folder for my project everything thing is working fine but showing following error on the page
The file 200901161440110.22177002.jpg specified in Picture was not found.
When I move my image to root folder this error gone.Below is folder code
$UD = $patients1->patient_name->GetValue();
$UD = str_replace(' ', '-', $UD); // Replace whitespace with Hyphen
$UD = stripslashes($UD); // Remove Starting and Engine Whitespace
$UD = preg_replace('~^(\s*)(.*?)(\s*)$~m', "\\2", $UD); //erases all NON-alfanumerics
if($patients1->EditMode)
{
// $patients1->FileUpload1->FileFolder = ("./patient/".$pid."/");
if(file_exists("patient/".$UD))
{
$patients1->FileUpload1->FileFolder = "./patient/".$UD."/";
}
else
{
mkdir("patient/$UD","124");
$patients1->FileUpload1->FileFolder = "./patient/".$UD."/";
}
}
else
{
$patients1->FileUpload1->Visible = false;
}
_________________
Girish Baraskar
Web Designer/Developer
http://www.agnisdesigners.com
http://www.eindianpaintings.com
http://www.realestatekolhapur.com |
|
|
yogiyang
Posts: 26
|
Posted: 05/23/2009, 12:21 AM |
|
Quote girish_327:
mkdir("patient/$UD","124");
I think you are passing a file name to mkdir. Just pass only the name according to which you want to crate a folder.
HTH
_________________
Regards,
Yogi Yang |
|
|
damian
Posts: 838
|
Posted: 05/23/2009, 2:14 AM |
|
Quote yogiyang:
Quote girish_327:
mkdir("patient/$UD","124");
I think you are passing a file name to mkdir. Just pass only the name according to which you want to crate a folder.
HTH
i dont think that is the case.
i think that this creates a folder like: patient/yogiyang and then sets appropriate permissions
_________________
if you found this post useful take the time to help someone else.... :)
|
|
|