Click to See Complete Forum and Search --> : hw_cp
bibistroc
05-03-2007, 12:51 PM
I don`t know very much php, but this script should move the file file.php into new/ directory?
<?php
$object_id_array = file.php
$destination_id = new/
int hw_cp ( int $connection, array $object_id_array, int $destination_id )
?>
But it doesn`t work :(
This is the error:
Parse error: syntax error, unexpected T_VARIABLE in file.php on line 5
Help me correct this script.
You've provided too little code to help debug your problem.
Post the whole script so we may help you.
NogDog
05-03-2007, 07:16 PM
Problem #1: Each command must be terminated with a semi-colon.
Problem #2: In the line in question, the literal string value being assigned to the variable must be quoted.
Prolem #3: You appear to have copied-and-pasted the hw_cp command straight from the manual page (glad you're reading the manual! ;) ), and in so doing you've included informational text about return value and argument types, which should not be included in the actual command.
I suspect the following will still not work, but it will be closer:
<?php
$object_id_array = "file.php";
$destination_id = "new/";
hw_cp ($connection, $object_id_array, $destination_id );
?>
bibistroc
05-04-2007, 12:19 AM
This script generate a new error:
Fatal error: Call to undefined function: hw_cp() in file.php on line 7
This is the script.
I wanna create a script that can move files to folder/s.
P.S The variable $connection should be set?
NogDog
05-04-2007, 01:17 AM
If you are processing a file upload from a form, use move_uploaded_file (http://www.php.net/manual/en/function.move-uploaded-file.php)(), otherwise use rename (http://www.php.net/rename)().
bibistroc
05-04-2007, 03:11 AM
Can you make me a script that allows me to copy a file from my server to a folder (existing folder)?
benifactor
05-04-2007, 09:52 AM
can you build us a spaceship? we are not here to make you script, but rather to help you with your problem. if you post the whole script you are having trouble with we may be able to help. it gives you an undefined function error because you don't have that function defined. please show the rest of your code.