Hi,
You must use the following in your <form ...> tag
enctype="multipart/form-data"
<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\" onsubmit=\"return
chkform()\" name=\"form\" enctype="multipart/form-data">
This is used to tell your browser the POST include image file not only
text. Hopes this help.
Danny Wong
"roN" <NOspam@example.com> ???????:43t3grF1oholrU5@individual.net...
> roN wrote:
>
>> Hi,
>>
>> I would like to enable customers to upload files. How do I do that? I
>> found following with
>>
> google:'http://www.tutorialized.com/tutorial/Simple-Form-Based-Image-Upload/792'
>> what seems to be nice, I included it like this in my code:
>>
PHP Code:
>> if ($_FILES['imagefile']['type'] == "image/gif" ||
>> $_FILES['imagefile']['type'] == "image/jpeg" ||
>> $_FILES['imagefile']['type'] == "image/jpg" ||)
>> {
>> copy ($_FILES['imagefile']['tmp_name'], "files/"
>> $_FILES['imagefile']['name'])
>> or die ("<b>Could not copy</b>");
>> echo "";
>> echo "Name: ".$_FILES['imagefile']['name']."<br>\n";
>> echo "Size: ".$_FILES['imagefile']['size']."<br>\n";
>> echo "Type: ".$_FILES['imagefile']['type']."<br>\n";
>> echo "Copy Done....<br>\n";
>> }
>> else
>> {
>> echo "<b>Couldn't upload your image, wrong filetype!<b><br>\n";
>> }
>>
>> while my html looks like:
>>
HTML Code:
>> <form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\"
>> onsubmit=\"return chkform()\" name=\"form\">
>> ...
>> ...
>> <td><p><input name="imagefile" type="file" size="15" maxlength="100000"
>> accept="text/*"></p></td>
>> ...
>> ...
>> </form>
>>
>> but it seems not to work, I always get 'Couldn't upload your image, wrong
>> filetype!'...Why? I tried to upload jpeg and gif image. Thank you!
>
> hm and there's nothing passed when I'm gonna check like:
> echo $HTTP_POST_FILES ['imagefile']['name']."<br>\n";
> here's just nothing, why not?
>
> --
> chEErs roN
>
> I'm root, I'm allowed to do this! ;)
> keep on rockin'