Jump to content


Photo

file not uploading!


  • Please log in to reply
5 replies to this topic

#1 kobel4k3r5

kobel4k3r5
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 28 September 2006 - 04:28 PM

hi, im trying to make a file upload script but it doesn't seem to be work. here's what i got. The test messages is only outputting a failed one.

-----------------------------------------
php.ini setup
upload_tmp_dir = /var/www/tmp

-----------------------------------------
upload form
    <form method="post" action="upload.php" enctype="multipart/form-data">
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    Choose: <input type="file" name="userfile" />
    <input type="submit" value="Upload" />
    </form>
-----------------------------------------
upload.php
<?

$file_name=$_FILES['userfile']['name'];
$temp_name=$_FILES['userfile']['tmp_name'];

if(is_uploaded_file($temp_name)) {
  echo "tmp uploaded"; //testing msg
 }
else { echo "tmp not uploaded"; } //test msg


?>


#2 mort

mort
  • Members
  • PipPipPip
  • Advanced Member
  • 82 posts

Posted 28 September 2006 - 05:15 PM

i use move_uploaded_file() to upload files via PHP

also you might need to specify an absolute path in the code

that any help?

#3 kobel4k3r5

kobel4k3r5
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 28 September 2006 - 05:27 PM

Well, yea. I'm just using is_uploaded_file() to check if the file has been uploaded to the temp dir first but it always fail to do so it. If i use move_uploaded_file(), it would return true since the file is not uploaded into the temp folder yet to even move the file to any location.

#4 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 28 September 2006 - 05:51 PM

Run a file that contains <?php phpinfo(); ?> and check if file_uploads is set to "On" under "PHP Core". If it's set to off, you cant upload files.

Orio.
Think you're smarty?

(Gone until 20 to November)

#5 kobel4k3r5

kobel4k3r5
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 28 September 2006 - 07:21 PM

file_uploads is on

uplodate_tmp_dir = /var/www/tmp

max file size is 2MB and I'm uploading about only 10kb file.

any idea why it is not uploading? I can't find it in my webiste.com/tmp folder.

#6 kobel4k3r5

kobel4k3r5
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 28 September 2006 - 07:39 PM

I got this to work. I changed the upload dir since it didn't exist.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users