Problem with file uploading
Moderator: General Moderators
- arjunyerla
- Forum Newbie
- Posts: 4
- Joined: Fri Jul 28, 2006 5:49 am
Problem with file uploading
Hi Guyz
can any one plz help me, i have a problem with my upload php script which i could not figure out.
my problem is when ever im trying to upload any file it is not getting upladed in to the temporary directory which i specified in the php.ini file but when im chechking it using the function is_uploaded_file method it i sshowing that the file has been uploaded.
can any one plz help me, i have a problem with my upload php script which i could not figure out.
my problem is when ever im trying to upload any file it is not getting upladed in to the temporary directory which i specified in the php.ini file but when im chechking it using the function is_uploaded_file method it i sshowing that the file has been uploaded.
- arjunyerla
- Forum Newbie
- Posts: 4
- Joined: Fri Jul 28, 2006 5:49 am
here is my code...
Code: Select all
<?php
$filename = $_FILE['file1']['name'];
if(move_uploaded_file ($_FILE['file1']['tmp_name'], "$filename"))
{
print "File has been Uploded succesfully!!!";
}
else
{
echo "Failed to upload file Contact Site admin to fix the problem";
}
print is_uploaded_file($_FILES['file1']['tmp_name']);
?>Add this...
and post the output
also, your not telling it what directory to move the file to
Code: Select all
echo '<pre>';
print_r($_FILES);
print "</pre>";also, your not telling it what directory to move the file to
- arjunyerla
- Forum Newbie
- Posts: 4
- Joined: Fri Jul 28, 2006 5:49 am
CODE:
OUTPUT:
Array
(
[file1] => Array
(
[name] => Substraction.java
[type] => application/octet-stream
[tmp_name] => C:\WINDOWS\php8E.tmp
[error] => 0
[size] => 192
)
)
Failed to upload file Contact Site admin to fix the problemC:\WINDOWS\php8E.tmp
Code: Select all
<?php
$filename = "c:/php/temp/";
echo '<pre>';
print_r($_FILES);
print "</pre>";
if(move_uploaded_file ($_FILE['file1']['tmp_name'], "$filename"))
{
print "File has been Uploded succesfully!!!";
}
else
{
echo "Failed to upload file Contact Site admin to fix the problem";
}
print $_FILES['file1']['tmp_name'];
print is_uploaded_file($_FILES['file1']['tmp_name']);
?>OUTPUT:
Array
(
[file1] => Array
(
[name] => Substraction.java
[type] => application/octet-stream
[tmp_name] => C:\WINDOWS\php8E.tmp
[error] => 0
[size] => 192
)
)
Failed to upload file Contact Site admin to fix the problemC:\WINDOWS\php8E.tmp
checnge your line to this
Code: Select all
if(move_uploaded_file ($_FILE['file1']['tmp_name'], $filename.$_FILE['file1']['name']))- arjunyerla
- Forum Newbie
- Posts: 4
- Joined: Fri Jul 28, 2006 5:49 am