Having problem with this code. I know the filename from the form element becomes a temporary file but how do I convert it to the original file name. Here is what I have so far:
The form:
<form method="post" action="upload.php?action=upload" enctype="multipart/form-data">
<input name="ulfile" type="file" size="45">
<input name="submit" type="submit" value="Upload">
</form>
The ftp_put code:
$ftp_server="localhost";
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server!");
$ftp_user="username";
$ftp_pass="******";
if(@ftp_login($conn_id, $ftp_user, $ftp_pass)){
ftp_chdir($conn_id, "path/to/directory");
$sourcefile = $ulfile;
$destinationfile = basename($ulfile);
$upload=ftp_put($conn_id, $destinationfile, $sourcefile, FTP_ASCII);
if(!$upload){
echo "FTP upload has failed!";
}else{
echo "Uploaded $ulfile successfully!";
}
}
ftp_quit($conn_id);
What is uploaded is a file named something like "php294ljf" and not the actual file name.
I have tried using $_FILES but I quite don't understand how to use it.