Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 02-14-2008, 01:36 AM Php Copy
Novice Talker

Posts: 11
Name: Johan
Trades: 0
copy files from a folder to a newly created folder..

Creating the mapp works fine, copy to a certain folder works fine but not to the newly created folder doesn´t work.

error message..
Warning: copy($mappnamn/stil.css) [function.copy]: failed to open stream: No such file or directory in /home/kundzonen/public_html/reg2.php on line 11
failed to copy test44/stil.css... Folder asdf created!

Can anyone help me ?
--------------------------------------------------------------------------------------------------------------
$foldername = $_POST[foldername];

mkdir($foldername);

$file = 'test44/stil.css';
$newfile = '$foldername/stil.css';

if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}

echo "Folder";
echo " ";
echo $foldername;
echo " ";
echo "created!";
SirFirekicker is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-14-2008, 02:16 AM Re: Php Copy
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
PHP Code:
if (is_writable($folder)) {
   if (
is_readable($source_file)) {
      if (
copy($source$target))
         echo 
"OK";
      else echo 
"Error";
   }
   else {
      echo 
"Source file is not readable";
   }
}
else {
   echo 
"Target folder not writable";

__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 02-14-2008, 03:05 AM Re: Php Copy
Novice Talker

Posts: 11
Name: Johan
Trades: 0
Target folder not writable Folder test created!

How do I make the new folders writable when i create them ?
SirFirekicker is offline
Reply With Quote
View Public Profile
 
Old 02-14-2008, 04:09 AM Re: Php Copy
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
http://www.php.net/manual/en/function.mkdir.php
PHP Code:
bool mkdir     string $pathname    [, int $mode    [, bool $recursive    [, resource $context   ]]] ) 
Translate in
PHP Code:
mkdir($dirName0777); 
Or with a chmod
PHP Code:
mkdir($dirName);
chmod($dirName0777); 
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 02-14-2008, 01:20 PM Re: Php Copy
Novice Talker

Posts: 11
Name: Johan
Trades: 0
hmm It makes the new folder 0777 but it doesn´t copy the file.

Says: Source file is not readable Folder 456u45u created!
SirFirekicker is offline
Reply With Quote
View Public Profile
 
Old 02-14-2008, 01:32 PM Re: Php Copy
Novice Talker

Posts: 11
Name: Johan
Trades: 0
I put in the whole adress to folder (/home/kundzonen/public_html/)

now the error message says: Error Folder hbvh created!
SirFirekicker is offline
Reply With Quote
View Public Profile
 
Old 02-14-2008, 02:10 PM Re: Php Copy
Novice Talker

Posts: 11
Name: Johan
Trades: 0
I found the error =)
SirFirekicker is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Php Copy
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25547 seconds with 12 queries