By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,530 Members | 891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,530 IT Pros & Developers. It's quick & easy.

File uploads not working

P: n/a
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\ChasityChase.com\www\admin\image\im age.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
/images/gallery/gallery_1.gif

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

Thanks in advance,
james
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <ne**@jamesarnall.com> wrote in message
news:Vv********************@comcast.com...
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\ChasityChase.com\www\admin\image\im age.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
/images/gallery/gallery_1.gif

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

Thanks in advance,
james

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.