
July 21st, 2003, 10:13 PM
|
|
Contributing User
|
|
Join Date: Jul 2003
Location: Toronto, Canada
Posts: 192
Time spent in forums: < 1 sec
Reputation Power: 6
|
|
|
Yet again upload images
k ive solved the whole upload and display image...im just wondering how to display the picture in a different place and if i do it that way that i can show different pictures instead of just the one that was previously uploaded...
PHP Code:
<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 ) {
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'] == "image/gif" ) {
move_uploaded_file( $file_array['tmp_name'], "$file_dir/$file_name")
or die ("Couldn't copy");
}
}
?>
<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";?>
thx again
|