File uploads not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James Arnall

    File uploads not working

    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_f ile(/images/gallery/gallery_1.gif): failed to
    open stream: No such file or directory in
    C:\Development\ ChasityChase.co m\www\admin\ima ge\image.php on line 16

    Warning: move_uploaded_f ile(): Unable to move
    'C:\PHP\uploadt emp\phpE4.tmp' to '/images/gallery/gallery_1.gif' in
    C:\Development\[sitename]\www\admin\imag e\image.php on line 16
    /images/gallery/gallery_1.gif

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

    Thanks in advance,
    james
  • Paul Barfoot

    #2
    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


    "James Arnall" <news@jamesarna ll.com> wrote in message
    news:VvqdnX0-nsCcc3_cRVn-1w@comcast.com. ..[color=blue]
    >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_f ile(/images/gallery/gallery_1.gif): failed to open
    > stream: No such file or directory in
    > C:\Development\ ChasityChase.co m\www\admin\ima ge\image.php on line 16
    >
    > Warning: move_uploaded_f ile(): Unable to move
    > 'C:\PHP\uploadt emp\phpE4.tmp' to '/images/gallery/gallery_1.gif' in
    > C:\Development\[sitename]\www\admin\imag e\image.php on line 16
    > /images/gallery/gallery_1.gif
    >
    > I am working in Windows XP Pro/IIS, in case you couldn't tell.
    >
    > Thanks in advance,
    > james[/color]


    Comment

    Working...