PHP uploader

O

old.Scully

Guest
I have a problem, i have downloaded an uploader php script so people can upload files to my website. The only problem is is that it don't work.

Do BW allow free hosts to use scripts of this kind??

If yes, and you have a properly functioning uploader, please contact me asap, any help would be very appreciated!!

Many Thanks

Scully:
 
O

old.Harrydb

Guest
script

I have the same problem using the following code. I did a chmod 777 on the upload directory so writing should be enabled.
I think maybe the upload path is incorrect because i read this somewhere in the faq, but i don't know if it is correctly.

Harry

---<upload.php>---

<html>
<body>
<Form method="POST" action="doupload.php" enctype="multipart/form-data">


Files to upload:

<input type="file" name="file1" size=30>

<input type="file" name="file2" size=30>

<input type="file" name="file3" size=30>

<input type="file" name="file4" size=30>

<input type="file" name="file5" size=30>

<input type="submit" name="submit" value="Upload">
</form>
</body>
</html>

---<doupload.php>---
<Html>

<?php include("head.inc"); ?>

<Body>



Process:


<?php

$thepath = "/websites/hosted/a6b/vakken"; //Absolute path to where files are uploaded. No trailing slash

//begin upload 1
if ($file1 === "") {
//checks if file is not empty
echo "No file selected for upload 1
";
}else{
//checks if file exists
if (file_exists("$thepath/$file1")) {
echo "File 1 already exists
";
}else{
//copy file to directory
if (copy($file1, "$thepath/$file1")){
echo "Upload started";
}else{
echo "Couldn't copy file 1 to server
";
}
if (file_exists("$thepath/$file1")) {
echo "File 1 was uploaded
";
}else{
echo "Upload of file 1 failed
";
}
}
}

?>

</Body>
</Html>
 
O

old.shihan

Guest
i had the same problem once. use

move_uploaded_file

instead of copy, than it should work fine.
 
T

Testin da Cable

Guest
be warned, setting a directory to mode '777' ie 'world writable' isn't a very safe thing to do. everybody has full control of the entire directory, thus the potential for mischief rather shocking.
 
O

old.Harrydb

Guest
Tanks for the warning about the chmod 777.
About the move_upload_file thing, i don't think that it will work because the $file variable is set to "none" so no file is uploaded, and i can't move the file ;-). Does anyone knows how to solve this problem??
 
O

old.nge

Guest
is the php server running is safe mode, if so you wont be able to upload
 
O

old.Harrydb

Guest
Could be, but it works perfectly now ;-)
 

Users who are viewing this thread

Similar threads

S
Replies
5
Views
726
L_Plates
L
S
Replies
2
Views
532
wyrd_fish
W
W
Replies
8
Views
1K
wyrd_fish
W
P
Replies
13
Views
1K
wyrd_fish
W
G
Replies
2
Views
577
Gegzy
G
Top Bottom