File uploads not working

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am trying a simple file upload, but cannot make it work on my
localhost.  I wrote the following code:

    $strFileDir = "/images/gallery/";        
    $strFileName = $strFileDir . $_FILES['fImage']['name'];
    if (move_uploaded_file($_FILES['fImage']['tmp_name'],$strFileName));
        echo ("Success");

....but get the following errors when uploading "gallery_1.gif":

Warning: move_uploaded_file(/images/gallery/gallery_1.gif): failed to
open stream: No such file or directory in
C:\Development\\www\admin\image\image.php on line 16

Warning: move_uploaded_file(): Unable to move
'C:\PHP\uploadtemp\phpE4.tmp' to '/images/gallery/gallery_1.gif' in
C:\Development\[sitename]\www\admin\image\image.php on line 16

I am working in Windows XP Pro/IIS, in case you couldn't tell.

Thanks in advance,

Re: File uploads not working

Hi James

You will need to give the full path of where you want the file moved to.

$strFileDir = "/images/gallery/";   won't work

$strFileDir = "c:/path/to/files/images/gallery/";  should work

Paul Barfoot

Quoted text here. Click to load it

Site Timeline