CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 [Solved} Moving photo between albums

Print topic Send  topic

Author Message
Markie


Posts: 251
Posted: 12/03/2008, 4:13 AM

I have a little problem moving an uploaded photo from one album to another. I have made a page where users can move a photo to a different album (editable grid). I have a listbox, showing all possible albums. The name of this listbox is "album"
In my grid there's also a hidden field showing the "old" albumname. The name of this hidden field is album2.
The name of the photo is in a text field, named "Basename"

I have made a AfterSubmit custom code in my editable grid:

$newalbumname = $Container->album->GetValue();
$Basename = $Container->Basename->GetValue();
$albumname = $Container->album2->GetValue();
define ("DIRECTORY", "$albumname");
do {
$dir = DIRECTORY;
while (!is_dir($dir)) {
$basedir = dirname($dir);
if ($basedir == '/' || is_dir($basedir))
mkdir($dir,1777);
else
$dir=$basedir;
}
} while ($dir != DIRECTORY);
rename("$albumname/".$Basename,"$newalbumname/".$Basename);

The output of my web page is:

Warning: rename(1stalbum/1stphoto.jpg,2ndalbum/1stphoto.jpg) [function.rename]: No such file or directory in C:\xampp\htdocs\mysite\edit_photos_events.php on line 166

Warning: Cannot modify header information - headers already sent by etc. etc.

So, there's something wrong with my code ...
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
Markie


Posts: 251
Posted: 12/03/2008, 5:08 AM

I think I have solved my problem myself, I used $container instead of $component. Now it works, with this code:

$newalbumname = $Component->album->GetValue();
$Basename = $Component->Basename->GetValue();
$albumname = $Component->album2->GetValue();
define ("DIRECTORY", "$albumname");
do {
$dir = DIRECTORY;
while (!is_dir($dir)) {
$basedir = dirname($dir);
if ($basedir == '/' || is_dir($basedir))
mkdir($dir,1777);
else
$dir=$basedir;
}
} while ($dir != DIRECTORY);
rename("$albumname/".$Basename,"$newalbumname/".$Basename);

_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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