Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

121 users online



File Uploading

File Uploading

Currently viewing this thread: 1 (0 members and 1 guests)


Mundo

Mundo

Neverside Newbie
Status: Offline!

File Uploading

So, I basically got this from spoono:

Code:

<html>
<head>
<title>TheMungo.com File Uploader</title>
</head>

<body>
<form action="index.php" method="post" ENCTYPE="multipart/form-data">
File to Upload: <input type="file" size="60" name="theFile">
<input type="hidden" name="MAX_FILE_SIZE" value="500000">
<input type="submit" value="upload">
</form>

</body>
</html>

<?
copy($theFile,"/home/themungo/public_html/up/theFile_name");
unlink($theFile);
?>

Except I can't get it to work! Anyone shed some light?

Located at http://themungo.com/up/

Heri

Heri

Poseidon
Status: Offline!

Try this. Also, make sure your directory path is correct.

Code:

<html>
<head>
<title>TheMungo.com File Uploader</title>
</head>

<body>
<form action="index.php" method="post" ENCTYPE="multipart/form-data">
File to Upload: <input type="file" size="60" name="theFile">
<input type="hidden" name="MAX_FILE_SIZE" value="500000">
<input type="submit" value="upload">
</form>

</body>
</html>

PHP:

<?php
$theFile 
$_FILES['theFile'];
copy($theFile,"/home/themungo/public_html/up/theFile_name");
unlink($theFile);
?>

Mundo

Mundo

Neverside Newbie
Status: Offline!

Nah, that gives me:

Warning: unlink() expects parameter 1 to be string, array given in /home/themungo/public_html/up/index.php on line 20

Im pretty sure its the correct directory path - how can i double check? I've got a phpinfo file at http://themungo.com/phpinfo.php if that helps...

schoi

schoi

funny and cheeky
Status: Offline!

$uploaddir="users/"
thats a subdirectory within the same directory as your script.
if(is_uploaded_file($_FILES['thefile']['tmp_name'])){

move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['thefile']['name']);
}
I use this and it works for me.

Last edited by schoi, April 4th, 2007 12:09 PM (Edited 1 times)

tcbil

tcbil

I hate Customer Services!
Status: Offline!

I think you will also need to chmod the directory using an ftp program to 777? i might just be talking out of my bum though!

Another good place to check would also be http://www.w3schools.com/php/php_file_upload.asp

I have used that one in the past and know it works!

___________________

PHP Freak Wannabe!

Last edited by tcbil, April 5th, 2007 02:20 PM (Edited 1 times)

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0084 seconds.