Move uploadedfile error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Move uploadedfile error

Post by michaelh613 »

First i am running PHP on a Windows2003 server

Code: Select all

 
    if (move_uploaded_file($_FILES['creative']['tmp_name'], "C:\Inetpub\Sites\test\secure\images\banner\\$filename"))
            print "move successful to C:\Inetpub\Sites\test\test\images\banner\\$filename";
        else
            print "move to C:\Inetpub\Sites\test\secure\images\banner\\$filename failed";
 

The error I receive is

Warning: move_uploaded_file(C:\Inetpub\Sites\test\secure\images\banner\test.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\Inetpub\test\test\admin\upload.php on line 16

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\Temp\php97.tmp' to 'C:\Inetpub\Sites\test\secure\images\banner\222-fix.jpg' in C:\Inetpub\Sites\test\admin\upload.php on line 16
move to C:\Inetpub\Sites\test\secure\images\banner\222-fix.jpg failed

I'm sure I am missing something minor here. It looks like it is messing upthe tmp file name
Last edited by michaelh613 on Mon Jul 14, 2008 4:53 pm, edited 1 time in total.
Dynamis
Forum Contributor
Posts: 122
Joined: Thu Jul 10, 2008 3:15 pm
Location: Indiana, US

Re: Move uploadedfile error

Post by Dynamis »

I would need to see more of your code to really help you out, so if you want to post more. Otherwise, this tutorial is very helpful and should answer any questions you have with move_uploaded_file function

http://www.tizag.com/phpT/fileupload.php
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Re: Move uploadedfile error

Post by michaelh613 »

Thanks

Actually was not escaping my

\

In windows. Once I did that it resolved my issue.

Thanks
Post Reply