ALLOW FILE UPLOADS...?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello,

sorry in advance if my question is naive..  i'm trying to allow file
uploads. optimally i'd like to store these files (jpgs, mostly) directly to
a folder in my httpdocs..  i've heard something about file uploads not being
allowed if server is set to safemode..  not sure why but i've been getting
errors.. here're the two files if you have time to check them out.  thanks
for your time!

xo, -z
----------
[file1.html]

<form enctype="multipart/form-data"
action="file2.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="10000000">
FILENAME: <input name="filename1" type="file"><br><input type="submit"
value="submit"></form>


----------
[file2.php

<?php
 $uploads_dir = '/release_pics/';
 foreach ($_FILES as $myfile) {
  $filename = $myfile['name'];
  switch ($myfile['error']) {
   case 4:
    continue 2;
   case 1:
   case 2:
    print "sorry, $filename is too big.<br>";
    continue 2;
   case 3:
    print "the upload of file $filename was broken.  please try again.<br>";
    continue 2;
   }
  print "received: $filename.";
  print "type: $myfile['type'].<br>";
  move_uploaded_file(
   $myfile['tmp_name'],
   $uploads_dir.$myfile['name']);
  }
?> 


-- 

fourthcity 2005 ; slow yr roll. ---> http://www.fourthcity.net/


 quick links:
 >    http://www.fourthcity.net/                   [    fct]
 >    http://www.zapan.net/                        [  zapan]
 >    http://www.laptopbattle.org/                 [ battle]
 >    http://www.postermidget.com/                 [ midget]


                  +
           +
                             +
     +         +
                     +
             +


----> much love! from the fourthcity studios  <----

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux