Get ready for BLACK FRIDAY shopping starting in

Forums

PHP

This topic is locked

Uploading and viewing images

Posted 31 Dec 2007 16:42:50
1
has voted
31 Dec 2007 16:42:50 Oriyomi Shokunbi posted:
Hi,
How do I use Dreamweaver to create updateable image page. where people can upload their pix and view it and at the same time can change the picture and add more to it?

Urmy

Replies

Replied 08 Jan 2008 05:07:23
08 Jan 2008 05:07:23 ricky Fadalo replied:
Hello friend if you want to upload the file or pic dynamic you have to know server side programing . you can use PHP or ASP to upload the file just download the php manual from php.net

There a lot of function that u can use .
For your problem u can use
"function copy()" or "function move_uploaded_file() "

Here the sample
To make your form
---------------------------------------------------------------------------------
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="__URL__" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>

-----------------------------------------------------------------------------------

here the php code
----------------------------------------------------------------------------------
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

?>


Thanks You
Please Contact me at

Reply to this topic