Hi,
I'm trying to upload a file in php to my ftp. And according to the output I'm getting, there are no PHP errors. But the file never shows up in my ftp. Can someone please help? Here is my snippet of code:
This is the form that is used to select the file:
<form method="POST" enctype="multipart/form-data" action="uploadfilesprocess.php?projname=<? echo "$projname"; ?>">
<table cellpadding=10 cellspacing=0 align=left valign=top border=0>
<tr>
<td align=left valign=top>File to upload:</td>
<td align=left valign=top><input type=file name="upfile"><br></td>
</tr>
<tr>
<td align=left valign=top colspan=2><input type=submit value="Upload"></td>
</tr>
</table>
<br>
</form>
And here is the script that uploads:
require("ftpconn.php");
ftp_pasv;
if (ftp_chdir($ftpconn, "/www/wjbe/$projname")) {
if (ftp_put($ftpconn, $upfile, $upfile, FTP_BINARY)) {
ftp_quit($ftpconn);
echo "File uploaded.<br><br>
<a href=\"uploadfiles2.php?projname=$projname\">upload more files</a> | <a href=\"main.php\">main menu</a>";
ftp_quit($ftpconn);
}
else {
echo "Upload failed.";
}
}
else {
echo "Couldn't shift directories.";
}