Uploading with windows

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Uploading with windows

Postby Katocan » 20. July 2006 16:47

Hey everyone, I'm trying to upload files using PHP and I'm using windows, I know it dosnt have CHMOD but is there anyway in which there are permissions I can change so that I can upload files to a certain folder or will I need to install Linux to be able to upload files via PHP.

Thanks :)
Katocan
 
Posts: 8
Joined: 20. July 2006 16:40

Postby Wiedmann » 20. July 2006 17:29

Where is your problem with file uploads?

BTW:
You have read the PHP manual about "Handling file uploads" (Chapter 38)?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Katocan » 20. July 2006 18:58

No I know I PHP quite well and its something to do with folder permissions as I can upload files when I used a server my friend provided which was Linux, but is there anyway I can get it to work on windows?
Katocan
 
Posts: 8
Joined: 20. July 2006 16:40

Postby Wiedmann » 20. July 2006 20:15

There is no difference in the file upload feature bettwen *nix and windows. (Problems with permissions are most seen on *nix.)

BTW:
Without a sample script and/or error messages I can't help you.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Katocan » 20. July 2006 21:35

Heres the code.
Code: Select all
<?
if(!empty($_FILES["userfile"])) {
    $uploaddir = "/uploads/";

    if (move_uploaded_file($_FILES["userfile"]["tmp_name"], $uploaddir . $_FILES["userfile"]["name"])) {
           echo("file uploaded");
    } else {
        echo ("error!");
    }
}
Katocan
 
Posts: 8
Joined: 20. July 2006 16:40

Postby Wiedmann » 20. July 2006 21:49

Error message you get in the brower (or what happens during upload)?

BTW:
If you want debug a script, you should add
Code: Select all
error_reporting(E_ALL);
ini_set('display_errors', '1');

after the line with "<?php".

Also the value of $_FILES is interesting here:
Code: Select all
echo var_dump($_FILES);
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Katocan » 20. July 2006 22:21

The error I get is
Warning: move_uploaded_file(/uploads/loading.gif) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\katocan\index.php on line 51

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Program Files\xampp\tmp\php441.tmp' to '/uploads/loading.gif' in C:\Program Files\xampp\htdocs\katocan\index.php on line 51
error!


Thanks for the help, it means alot![/code]
Katocan
 
Posts: 8
Joined: 20. July 2006 16:40

Postby Wiedmann » 20. July 2006 22:36

Warning: move_uploaded_file(/uploads/loading.gif) [function.move-uploaded-file]: failed to open stream: No such file or directory

This directory "/uploads/" exists?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Katocan » 20. July 2006 22:45

Ye the directory exists
Katocan
 
Posts: 8
Joined: 20. July 2006 16:40

Postby Wiedmann » 20. July 2006 23:07

One test:
Please open a command shell (cmd.exe) and execute this command:
Code: Select all
dir \uploads\

(then copy 'n paste the result into your reply to this post)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Katocan » 20. July 2006 23:17

The system cannot find the file specified.

C:\Program Files\xampp\htdocs\katocan>dir uploads
Volume in drive C has no label.
Volume Serial Number is DC7F-EF0E

Directory of C:\Program Files\xampp\htdocs\katocan\uploads

20/07/2006 04:50 <DIR> .
20/07/2006 04:50 <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 14,347,763,712 bytes free
Katocan
 
Posts: 8
Joined: 20. July 2006 16:40

Postby Wiedmann » 20. July 2006 23:21

Well...

What did you think. Is:
"C:\Program Files\xampp\htdocs\katocan\uploads\"
is the same as:
"\uploads\"

(Simply count the chars from the two strings)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Katocan » 20. July 2006 23:31

So...what shall I do?
Katocan
 
Posts: 8
Joined: 20. July 2006 16:40

Postby Katocan » 20. July 2006 23:32

Oh nevermind I got it, haha thanks so much for the help man!
I owe you one!
Katocan
 
Posts: 8
Joined: 20. July 2006 16:40


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 72 guests