Page 1 of 1

PHP Upload

Posted: Tue Jul 22, 2003 12:32 am
by Bruski
i just have some problems with displaying a picture when i upload...i can display it but it displays in the default file ... i want to display that picture in a different file so that i can move it around...also it only seems to be displaying the last image i select i would like to choose which picture to show ....

if u want the code ill give it to u

Posted: Tue Jul 22, 2003 2:06 am
by qartis
Yea, I think we'll need the code..

Posted: Tue Jul 22, 2003 10:42 am
by Bruski

Code: Select all

<html>
 <head>
 <title>Listing file upload script</title>
 </head>
 <?php
 $file_dir = "../cgi-bin/";
 $file_url = "http://bruski.recongamer.com/cgi-bin/";
 
 foreach( $HTTP_POST_FILES as $file_name => $file_array ) &#123;
   print "path: ".$file_array&#1111;'tmp_name']."<br>\n";
   print "name: ".$file_array&#1111;'name']."<br>\n";
   print "type: ".$file_array&#1111;'type']."<br>\n";
   print "size: ".$file_array&#1111;'size']."<br>\n";
 
   if ( is_uploaded_file( $file_array&#1111;'tmp_name'] ) 
     && $file_array&#1111;'type'] == "image/gif" ) &#123;
     move_uploaded_file( $file_array&#1111;'tmp_name'], "$file_dir/$file_name") 
       or die ("Couldn't copy");
     
 &#125;
&#125;
 
?>
<body>
<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
 <input type="file" name="fupload"><br>
<input type="submit" value="Send file!">
</form>
</body>
</html>
<?php
print "<img src="$file_url/$file_name"><p>\n\n";?>
here is the code

Posted: Wed Jul 23, 2003 10:24 pm
by Bruski
any suggestions