Did you read that link at all?????????

adapting the manual's code to suit your form names and directory
preferences:

if (is_uploaded_file($_FILES['image1']['tmp_name'])) {
    copy($_FILES['image1']['tmp_name'],
"$DOCUMENT_ROOT/images/$_FILES['image1']['name']");
} else {
    echo "Couldn't do it!";
}

So, to summarise what i *think* is wrong with your code:

1. $_FILES['image1']['image1'] should have been
$_FILES['image1']['tmp_name']

2. $DOCUMENT_ROOT/images/$file :: what is $file???? where is that defined???
I *think* you wish to save the file with same name as the user had it
named??? if so "$DOCUMENT_ROOT/images/$_FILES['image1']['name']" is what you
want, or better still, for clarity,
"{$DOCUMENT_ROOT}/images/{$_FILES['image1']['name']}"


If all else fails do a print_r($_FILES) and make sure that the file is at
least being uploaded.


Like I said before, there is a perfect working example in the manual... get
it working THEN try to adapt it to suit your needs :)


Cheers,

Justin



on 12/01/03 11:39 PM, Kyle Babich ([EMAIL PROTECTED]) wrote:

> This is what I tried:
> 
> if (is_uploaded_file($HTTP_POST_FILES['image1']['image1']) {
> move_uploaded_file($HTTP_POST_FILES['image1']['image1'],
> "$DOCUMENT_ROOT/images/$file");
> }
> 
> and also this:
> 
> if (is_uploaded_file($_FILES['image1']['image1']) {
> move_uploaded_file($_FILES['image1']['image1'],
> "$DOCUMENT_ROOT/images/$file");
> }
> 
> and this:
> 
> if (is_uploaded_file($_FILES['image1']['image1'])) {
> copy($_FILES['image1']['image1'], "$DOCUMENT_ROOT/images");
> }
> 
> ,the image (which was within the size range) was never uploaded.  I have
> a feeling that I am makeing 1 or 2 of the same mistakes in all three but
> through my experimenting and reading I am having no luck.  I also bought
> Programming PHP but I trust it less and less as I even find simple
> mistakes like missing quotes in example code.  So what's going wrong?
> 
> Thank you again,
> Kyle
> 
> On Sun, 12 Jan 2003 15:17:42 +1100, "Justin French"
> <[EMAIL PROTECTED]> said:
>> Hi,
>> 
>> the files themselves are available in the $_FILES array, but it's not as
>> simple as that.
>> 
>> may i recommend you start by copying the Examples 18-1 and 18-2 from this
>> page:
>> http://www.php.net/manual/en/features.file-upload.php
>> 
>> Once you've got THAT code working smoothly and understand what's
>> happening,
>> THEN start modifying it to a 3-file form.
>> 
>> I'd personally push forms through using POST method rather than get
>> whenever
>> possible -- especially when dealing with files... the manual does it this
>> way too :)
>> 
>> 
>> Justin
>> 
>> 
>> 
>> on 12/01/03 12:18 PM, Kyle Babich ([EMAIL PROTECTED]) wrote:
>> 
>>> I just broke skin with php and I'm learning forms, which I'm not good
>>> with at all.  These are snippets from post.html:
>>> 
>>> <form method="get" action="process.php" enctype="multipart/form-data">
>>> and
>>> <input type="file" name="image1" maxlength="750" allow="images/*"><br>
>>> <input type="file" name="image2" maxlength="750" allow="images/*"><br>
>>> <input type="file" name="image3" maxlength="750" allow="images/*"><br>
>>> 
>>> but how would I pass the actual image on because when I do something like
>>> this:
>>> <?php echo "{$_GET[image1]}";
>>> ?>
>>> as you could probably guess only the filename prints.
>>> 
>>> So how do I take the image instead of just the filename?
>>> 
>>> Thank you,
>>> --
>>> Kyle
>> 
>> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to