AaaDee wrote:Ok, whats wrong with this, it ONLY uploads jpg files, i thought i was the daddy at first but it only works for jpgs, want it to work for ALL of the files!!!!
<?
if (is_uploaded_file($attach) != '')
{
copy($attach, "Uploads/$attach_name");
}
?>
Hi there!
It's most popularity mistakes of beginner programmer on PHP.
And will best if you using file size.... etc.
Cause PHP and MIME working together.
- Code: Select all
<form enctype="multipart/form-data" action="_URL_" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
See this code, and try make some like this (from manual of PHP).
or this:
- Code: Select all
<?php
// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of $_FILES.
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
copy($_FILES['userfile']['tmp_name'], "/place/to/put/uploaded/file");
} else {
echo "Possible file upload attack. Filename: " . $_FILES['userfile']['name'];
}
/* ...or... */
move_uploaded_file($_FILES['userfile']['tmp_name'], "/place/to/put/uploaded/file");
?>