something strange with file inputs and ftp functions

liunx

Guest
does anyone know why php does this? i was making a file uploader script that uses the php ftp functions. for some reason it always uploaded images as a red x. then i finally came across with the solution:

the image uploads with errors when:

$upload = ftp_put($conn_id, $_POST['file_dest'], $_POST['file_source'], FTP_BINARY) or die("Unable to upload file");

but not when:

$upload = ftp_put($conn_id, $file_dest, $file_source, FTP_BINARY) or die("Unable to upload file");


it baffles me as to why it doesnt work if you use it with $_POST2 things come to mind.

1) you don't have regiter globals turned off.

2) always use " in the globals $_POST["file_dest"]well, the thing is, i use $_POST['variable'] for everything else, and it works fine. if i use POST it uploads the image with the right dimensions, buts its a red x, and if i dont its the right image....its weirddid you try it. I have it work like you say then the next tiem it doesn't. for some reason it is empty if you use teh single quote. try it and see if you can use the double quote and if it doesn't work then you can't use post, also are the globals OFF, if they are on and you use POST it deos really wierd things.if i use quotes it doesnt even keep the right dimensions, its just a small red x. i guess it must be because register globals isnt offWhat version of PHP?its 4.3Hang on a minute *re-reading first post* shouldn't that be something like$_FILES['myFile']['file_source']Haven't uploaded files for a while but I'm sure the array is multi-dimensional. Need to check....brbhaha, i didnt even know there was such thing as $_FILE
ill try it when i get home later todaythanks! it worked
 
Back
Top