Page 1 of 1

Move uploadedfile error

Posted: Mon Jul 14, 2008 3:26 pm
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

Re: Move uploadedfile error

Posted: Mon Jul 14, 2008 3:33 pm
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

Re: Move uploadedfile error

Posted: Mon Jul 14, 2008 4:52 pm
by michaelh613
Thanks

Actually was not escaping my

\

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

Thanks