Page 1 of 1

Uploading File Trouble.

Posted: Thu Jun 29, 2006 7:07 pm
by cweathers
I have check everything. Safe Mode is off, my permissions seem correct, and I'm using the right syntax. I am still getting error messages when trying to upload a file onto the server.

I am using php 5: Here are the errors

Warning: move_uploaded_file(./wwwroot/karisumusic/dbpictures/glopez.gif) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\SWsoft\PEM\CustomerData\webspaces\webspace_00002119\wwwroot\karisumusic\uploadpicture.php on line 15

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\TEMP\php4DA6.tmp' to './wwwroot/karisumusic/dbpictures/glopez.gif' in C:\SWsoft\PEM\CustomerData\webspaces\webspace_00002119\wwwroot\karisumusic\uploadpicture.php on line 15

I have tried so much, if someone knows of any solutions PLEASE let a brother know.


Here is my code:

Code: Select all

<?php

$uploaddir = './wwwroot/karisumusic/dbpictures/';
$uploadfile = "$uploaddir" . $_FILES['userfile']['name'];

if (move_uploaded_file($_FILES['userfile']['tmp_name'], "$uploadfile")) {
   echo "File is valid, and was successfully uploaded.\n";
} else {
   echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);


?>

Posted: Thu Jun 29, 2006 7:45 pm
by bdlang
Try

Code: Select all

$uploaddir = './dbpictures/';
Your error message indicates you are already in the directory 'wwwroot\karisumusic\', so there is no './wwwroot/karisumusic/dbpictures/' directory.

Make sure the 'dbpictures' directory exists, and try again.

Posted: Thu Jun 29, 2006 7:48 pm
by basdog22
$uploaddir = './wwwroot/karisumusic/dbpictures/';
I think it should be :

Code: Select all

$uploaddir = './dbpictures/';
If your root is like :
karisumusic/index.php

and you want to use the './' then you should do it like i mentioned above

EDIT: kudos bdlang :D

Posted: Thu Jun 29, 2006 8:36 pm
by cweathers
now it says \

Warning: move_uploaded_file(./dbpictures/glopez.gif) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\SWsoft\PEM\CustomerData\webspaces\webspace_00002119\wwwroot\karisumusic\uploadpicture.php on line 15

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\TEMP\php4ECC.tmp' to './dbpictures/glopez.gif' in C:\SWsoft\PEM\CustomerData\webspaces\webspace_00002119\wwwroot\karisumusic\uploadpicture.php on line 15
Possible file upload attack! Here is some more debugging info:Array ( [userfile] => Array ( [name] => glopez.gif [type] => image/gif [tmp_name] => C:\WINDOWS\TEMP\php4ECC.tmp [error] => 0 [size] => 42315 ) )

Permission Denied

Posted: Thu Jun 29, 2006 9:02 pm
by bdlang
Hmm. Is this on a shared server or are you admin on this machine? Is safe mode enabled?

Posted: Thu Jun 29, 2006 9:07 pm
by basdog22
Try uploading it to './' and then check to see where the file is.

If it is in wwwroot/glopez.gif then you must try using './karisumusic/dbpictures/'; instead

Posted: Thu Jun 29, 2006 9:50 pm
by cweathers
safe mode has been off and i tried to upload it using every folder path i could think to use to get it where i wanted it.

./dbpictures/
./dbpictures
wwwroot/karisumusic/dbpictures
wwwroot/karisumusic/dbpictures/
/karisumusic/dbpictures/
/karisumusic/dbpictures
karisumusic/dbpictures/


just every thing.

yeah its a shared server. Mydomain.com. They couldnt even help me, maybe I should get another host. But there has got to be some permission I need to change somehwere.