Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 28th, 2004, 02:42 PM
Registered User
 
Join Date: Jul 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default File Uploading problem in Win XP

hi
i am a beginner in php...
i just want 2 upload a file frm a windir to my hosted dir like '/rafatrock/base'.
for this i have used copy,rename,move_uploaded_file functions where the source address is like 'F:\basement\color\blue.zip' ......

if i try 2 copy a file frm my root directory ..i mean c:\ then its ok..but if it isnt C:\ then the file is uploaded but not the actual file the temporary file like "php2.tmp" the file size remain same...can anybody give me a proper solution plz.


my operating system is WINXP, PHP-4.1.1, web server 1.3.23 phpmyadmin 2.2.3

a dangerous game is about to begin
 
Old December 29th, 2004, 08:55 AM
Authorized User
 
Join Date: Dec 2004
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to peg110
Default

I would start by checking out http://us4.php.net/manual/en/feature...ad.post-method

it details what you need to do to upload a file. It's important to note that the file upload DOES store the file in a temporary location and you must move it from there to it's intended permanent location. I suspect this is a security thing to prevent people from uploading files arbitrailly to your system.

Hope this helps get you started.



Paul Gardner
------------------
PHP-LIVE help
Via Web @ http://www.mnetweb.co.uk/irc
Via IRC Client pgardner.net:6667
room #PHP
 
Old December 29th, 2004, 02:58 PM
Authorized User
 
Join Date: Jul 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rajuru Send a message via Yahoo to rajuru
Default

welcome rafatrock

a little bit of source code may help us to identify the problem

please post your codes

still, here is my script which i used successfully,

<form method="POST" enctype="multipart/form-data" action="<?php $_SERVER['PHP_SELF']; ?>">
<input type="file" name="file" size="20">
<input type="submit" value="Submit" name="submit">

</form>

<?php
if(isset($_POST['submit'])){
    $uploaddir = "photo/";
    $uploadfile = $uploaddir . $_FILES['file']['name'];

    if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
    echo "File was successfully uploaded. ";
     } else {
    echo "Error while uploading file";
    }
}

?>

you may need to rename the value $uploaddir variable

Best Regard:
Md. Zakir Hossain (Raju)
www.rubd.net
www.xenex.rubd.net
www.forum.rubd.net





Similar Threads
Thread Thread Starter Forum Replies Last Post
help:: Prob with DCOM in Win XP sachin_dm C++ Programming 2 March 23rd, 2005 01:28 AM
Installing PHP on Win XP how to ? tandhy BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 April 6th, 2004 12:51 PM
Win '98 vs. Win XP rgerald Access VBA 0 February 19th, 2004 12:30 PM
Zip a file from using Win XP compressed folder Mitch VBScript 1 January 6th, 2004 08:58 AM
Win xp Pro + IIS morpheus Access 2 November 21st, 2003 10:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.