PHP

Moderators: None (Apply to moderate this forum)
Number of threads: 1847
Number of posts: 5013

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
move_uploaded_file Directory Help Posted by mailedfist on 6 Aug 2004 at 4:03 PM
Hi I am using move_uploaded_file() to store a picture on my server but I am having problems getting the file to be stored in the correct directory. I want the file to be saved in a folder called 'pics' which is in the same directory as the .php file but it is always stored in the same directory as my .php file. Here is my code...

$updir = "pics/";
$upDir .= $_FILES['userfile']['name'];
$upDir = rawurlencode($upDir);

move_uploaded_file($_FILES['userfile']['tmp_name'], $upDir);

I've tried changing the line
$upDir = "pics/";
To many different thing but I always end up with the file saved in the parent directory of the pics folder (the parent directory of pics holds the .php file).

What am I missing? Thanks!


Report
Re: move_uploaded_file Directory Help Posted by mailedfist on 6 Aug 2004 at 4:25 PM
Nevermind I fixed it... Here is the code for reference...

$upDir = "pics/".$_FILES['userfile']['name'];

move_uploaded_file($_FILES['userfile']['tmp_name'], $upDir)



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.