-
*PHP* Upload
Hello. Me once again. I made this script that's supposed to upload picture files to my site, but it's broken and I cannot, for the life of me, figure out what's wrong with it.
My Code:
Code:
<?
$file = stripslashes($file);
/*Get rid of the slashes inserted by Flash*/
echo $file;
/*Make sure we have the correct file*/
$conn = ftp_connect("*****");
/*Connect*/
ftp_login($conn, "*****", "*****");
/*Hah! Did you really think I was going to give you my username and password?? You fools! :D*/
ftp_chdir($conn, "*****");
/*Change the directory to the one I want realative to the root directory*/
ftp_put($conn, $file, FTP_IMAGE);
/*Upload the file*/
ftp_close($conn);
/*Close the connection*/
?>
Thanks in advance,
Furry
-
Hi,
ftp_put seems to take a local and remote file parameter, and all of these functions can be checked for error
Musicman
-
Checked? How? Is there some checkcode(); function or something that I don't known about? If you mean check manually, I've already done that so much my eyes actually started to hurt, and that means a headache isn't far off.
Thanks for your time.
-
Hi,
its like
if(!($conn = ftp_connect("..."))) print "connect failed";
for the connect. All the others return true/false, so you can write
if(!ftp_xxx($conn, ....)) print ("xxxx failed");
Musicman
-
Oh I see. Thanks, Musicman.
-
Hey! I figured out what was wrong with my script, in case anybody was curious. Nothing was wrong at all, as far as I can tell. The FTP functions are not supported by my website service provider. >: ( I'm going to call them and ask them to enable them.
Later,
Furry
-
If that doesn't work - you could try using is_uploaded_file, move_uploaded_file, etc. to upload stuff: check the manual for how it works.
Ferg