;

PDA

Click to See Complete Forum and Search --> : *PHP* Upload


Fat_N_Furry
12-07-2002, 01:12 PM
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:


<?

$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

Musicman
12-07-2002, 01:41 PM
Hi,

ftp_put seems to take a local and remote file parameter, and all of these functions can be checked for error

Musicman

Fat_N_Furry
12-07-2002, 01:46 PM
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.

Musicman
12-07-2002, 02:10 PM
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

Fat_N_Furry
12-07-2002, 03:56 PM
Oh I see. Thanks, Musicman.

Fat_N_Furry
12-08-2002, 02:44 PM
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

BigFerg
12-09-2002, 11:43 AM
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