Re: [NEWBIE] Trying to create a function from an existing script
| From: | Jon | Date: | Fri, 28 Jan 2005 06:37:35 +0000 |
| Subject: | Re: [NEWBIE] Trying to create a function from an existing script | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-207554@lists.php.net to get a copy of this message | ||
Dave,
Another quick note. If you are using this in a function with
register_globals off in you php.conf you will need to do global
$_HTTP_POST_FILES or use $_FILES['upfile']['temp_name'] instead.
On Fri, 2005-01-28 at 15:18 +0900, Dave wrote:
> Jon,
> Thanks for responding. Unfortunately, it still doesn't work. I tried
> it exactly as you wrote, and it still gives me the message that it
> failed to upload.
> Also, I actually want to force a name change to the file, so that
> regardless of what the name of the file uploaded is, it gets changed to
> "imagefile.jpg". I did try it exactly as you suggested, and it didn't
> work so I think there is something else I'm doing wrong. But I thought I
> should mention now that I want to impose my own name on the file, to
> save confusion later.
>
> Here is the whole if() statement:
>
>
> if(move_uploaded_file($_HTTP_POST_FILES['upfile']['tmp_name'],rawurlencode($store_dir.
>
> "imagefile.jpg")))
> {
> echo("Uploaded ".$HTTP_POST_FILES['upfile']['name']."
> successfully.");
> }
> // If the copy function fails output a message.
> else
> {
> echo("Upload of ".$HTTP_POST_FILES['upfile']['name']." to
>
> ".$store_dir." failed.");
> }
>
> --
> Dave Gutteridge
> dave@tokyocomedy.com
>