On Mon, 2003-10-06 at 13:05, Jason Wong wrote:
Now I tried the method with move_uploaded (http-upload).
This is the testscript
<?php
// upload.php: PHP File Upload im Safe Mode 21.5.02/vo
// (http-Protokoll und POST-Mechanismus)
// Skript funktioniert auch im Safe Mode, da
// die Funktion move_uploaded_file verwendet wird.
if ($img1_name == "") {
?>
<html>
<head>
<title>Upload a File</title>
</head>
<!--
Formular: in einem Filepanel kann der Name des lokalen Files angegeben
werden, das auf den Server hochgeladen werden soll.
-->
<body>
<h1>Upload a File</h1>
<form enctype="multipart/form-data" method="post"
action="<?php echo $PHP_SELF?>">
<p><strong>File to Upload:</strong><br>
<input type="file" name="img1" size="30"></p>
<P><input type="submit" name="submit" value="Upload File"></p>
</form>
<?php
}
// Das Formular ist ausgefuellt worden...
else {
$curdir=getcwd();
// der Filename kommt vom Formularfeld img1, s. oben.
// Dieser Touch muss mit dem cgi-Skript gemacht werden:
// exec("/usr/local/info-sys/cgi-bin/phptouch $SCRIPT_FILENAME
$curdir/tmp/$img1_name",$t,$status);
move_uploaded_file("$img1", "./html/$img1_name");
// Dieser Chown muss mit dem cgi-Skript gemacht werden:
// exec("/usr/local/info-sys/cgi-bin/phpchown $SCRIPT_FILENAME
$curdir/tmp/$img1_name",$r,$status);
// Wichtig:
// rwx-Permissions erforderlich fuer Zielverzeichnis tmp
?>
<html>
<head>
<title>File Upload</title>
</head>
<body>
<P>You sent: <?php echo "$img1_name"; ?>, a <?php echo "$img1_size";
?> byte file with a mime type of <?php echo "$img1_type"; ?>.</p>
<?php
}
?>
</body>
</html>
And this are the errormessages.
Warning: move_uploaded_file(./html/udsklein.png)
[function.move-uploaded-file]: failed to create stream: No such file or
directory in /home/www/web172/html/upload.php on line 51
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
move '/home/www/web172/phptmp/php7AuByW' to './html/udsklein.png' in
/home/www/web172/html/upload.php on line 51
You sent: udsklein.png, a 5741 byte file with a mime type of image/png.
What can be wrong here
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php