Make sure your form has the right encoding type for an upload. This example is taken from the manual:
PHP Code:
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="__URL__" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
and this:
PHP Code:
$conn_id = ftp_connect("site.org");
does this need the full path? ie http://www?
You might also want to look for the position of the . then get the extension from there, instead of taking the last 3 characters from the end. For instance, someones image file might have the .jpeg extension.
PHP Code:
$filetyp = substr($uploadfile, -3);
This would return jpe in this case.
I'd use:
PHP Code:
$extension = substr(strtolower(strrchr($filename, ".")), 1);
When you submit a file form, it populates the $_FILES superglobal array. From here you can access all the details you need. It seems you are making a copy of this array ($uploadfile) and passing it to the copy function. Really, you should use the move_upload_file, and pass it the appropriate $_FILE value.
Have a read on the manual
Bookmarks