Re: file upload faliure
| From: | Seung Hwan Kang | Date: | Sat, 19 Apr 2003 13:48:47 +0000 |
| Subject: | Re: file upload faliure | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-19500@lists.php.net to get a copy of this message | ||
What about the path to uploaded files?
Ok, here is my own codes. plz use it as a reference.
upload.html
---------------------------
<html>
...
<form enctype="multipart/form-data" action="upload.php" method="post">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
...
</html>
----------------------
<?
// upload.php
function fileupload()
{
if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{
$PATH = $_SERVER['DOCUMENT_ROOT'] . "/tmp/";
echo $_FILES['userfile'['type'];
copy($_FILES['userfile']['tmp_name'], $PATH . $_FILES['userfile']['name']);
}
else
{
echo "Possible file upload attack: filename " . $_FILES['userfile']['name'] . "<br>.";} } fileupload(); ?> Vivek Kumar wrote:
I have tried this code also and also turned the error_reporting(E_ALL); like: <?php error_reporting(E_ALL); if(is_uploaded_file($_FILES["userfile"]["tmp_name"])) { echo "File Name: ".$_FILES["userfile"]["name"]; ....and so on but all i get was Notice: Undefined index: userfile in C:\Program Files\Apache Group\Apache2\htdocs\php\fileupload.php on line 3 Notice: Undefined index: userfile in C:\Program Files\Apache Group\Apache2\htdocs\php\fileupload.php on line 9 Possible file upload attack: filename<?php // let's check it whether a file is uploadable or not if(is_uploaded_file($_FILES["userfile"]["tmp_name"])){ // display a file name echo "File Name: " . $_FILES["userfile"]["name"] . "<br>"; } else { echo "Possible file upload attack: filename " . $_FILES["userfile"]["name"]; } // and so on... ?>Vivek Kumar wrote: Hi all, i am trying to upload files over ssl in PHP................... ..............was not able to find out what is going wrong here.Is this a bug orsomething wrong with the code itself. I am using PHP-4.3.1-win32 manual install as anapache module,Apache-2.0.44-win32 with mod_ssl on Windows 2000. THX vivek kumar__________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com