[PHP] FILE UPLOAD Q

2003-06-08 Thread nabil
Please help me , I want to make any user on my website to submit his CV , or
any file to a temp folder, the following script create a fupload file ,
and I don't want to dump the original in it, I want to upload the file as it
is, with its extension...

by example


html
head
titleListing 9.14 A file upload script/title
/head
?php

$file_dir = C:\\Inetpub\\wwwroot\\temps\\uploads;
$file_url = http://localhost/temps\uploads;;

foreach( $HTTP_POST_FILES as $file_name = $file_array ) {
 print path: .$file_array['tmp_name'].br\n;
 print name: .$file_array['name'].br\n;
 print type: .$file_array['type'].br\n;
 print size: .$file_array['size'].br\n;

 if ( is_uploaded_file( $file_array['tmp_name'] )
   $file_array['type'] == text/plain ) {
  move_uploaded_file( $file_array['tmp_name'], $file_dir/$file_name)
   or die (Couldn't copy);
  print img src=\$file_url/$file_name\p\n\n;
 }
}

?
body
form enctype=multipart/form-data method=POST
input type=hidden name=MAX_FILE_SIZE value=51200
input type=file name=fuploadbr
input type=submit value=Send file!
/form
/body
/html


/



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



Re: [PHP] FILE UPLOAD Q

2003-06-08 Thread Philip Olson

That article is pretty old, and the code sucks.  
Read this instead:

  http://www.php.net/features.file-upload

It will explain everything.

Regards,
Philip


On Sun, 8 Jun 2003, nabil wrote:

 Please help me , I want to make any user on my website to submit his CV , or
 any file to a temp folder, the following script create a fupload file ,
 and I don't want to dump the original in it, I want to upload the file as it
 is, with its extension...
 
 by example
 
 
 html
 head
 titleListing 9.14 A file upload script/title
 /head
 ?php
 
 $file_dir = C:\\Inetpub\\wwwroot\\temps\\uploads;
 $file_url = http://localhost/temps\uploads;;
 
 foreach( $HTTP_POST_FILES as $file_name = $file_array ) {
  print path: .$file_array['tmp_name'].br\n;
  print name: .$file_array['name'].br\n;
  print type: .$file_array['type'].br\n;
  print size: .$file_array['size'].br\n;
 
  if ( is_uploaded_file( $file_array['tmp_name'] )
$file_array['type'] == text/plain ) {
   move_uploaded_file( $file_array['tmp_name'], $file_dir/$file_name)
or die (Couldn't copy);
   print img src=\$file_url/$file_name\p\n\n;
  }
 }
 
 ?
 body
 form enctype=multipart/form-data method=POST
 input type=hidden name=MAX_FILE_SIZE value=51200
 input type=file name=fuploadbr
 input type=submit value=Send file!
 /form
 /body
 /html
 
 
 /
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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