knigh7
03-23-2004, 03:49 AM
i get this error when i try to upload a csv
Warning: move_uploaded_file(/home/virtual/site15/fst/var/www/html/ve/csv.csv): failed to open stream: Permission denied in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 33
Warning: move_uploaded_file(): Unable to move '/tmp/phpApwnRt' to '/home/virtual/site15/fst/var/www/html/ve/csv.csv' in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 33
Possible file upload attack! Here's some debugging info:
Array
(
[userfile] => Array
(
[name] => csv.csv
[type] => application/octet-stream
[tmp_name] => /tmp/phpApwnRt
[error] => 0
[size] => 88
)
)
Warning: fopen(): Unable to access csv.csv in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 47
Warning: fopen(csv.csv): failed to open stream: No such file or directory in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 47
Warning: file(): Unable to access csv.csv in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 49
Warning: file(csv.csv): failed to open stream: No such file or directory in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 49
Warning: fgetcsv(): supplied argument is not a valid stream resource in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 55
Warning: fclose(): supplied argument is not a valid stream resource in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 67
===========================================
here is my upload file code
===========================================
<?php
$db = mysql_connect("localhost", "****","****");
mysql_select_db("*******",$db);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style10 { color: #FF0000;
font-weight: bold;
}
-->
</style>
</head>
<?
if(isset($_POST['submit']))
{
// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of
// $_FILES. In PHP earlier then 4.0.3, use copy() and is_uploaded_file()
// instead of move_uploaded_file
$uploaddir = '/home/virtual/site15/fst/var/www/html/ve/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
$row = 0;
$handle = fopen ("csv.csv","r");
$myfile = file("csv.csv");
$totallines = count($myfile);
$sql ="DELETE FROM jobs";
$result = mysql_query($sql);
while ($data = fgetcsv ($handle, 10000, ",")) {
$num = count ($data);
$row++;
$sql = "INSERT INTO jobs (name,pass) VALUES ('aa" .$data[1]. "','" .$data[2]. "')";
echo $row . " of " .$totallines . " added<br>";
$result = mysql_query($sql);
}
fclose ($handle);
}
else
{
?>
<body>
<form name="upload" method="POST" action="upload.php" enctype="multipart/form-data">
<p> </p>
<p align="center">
<input name="userfile" type="file" class="button" size="30">
</p>
<p align="center"><span class="style10">
<input name="submit" type="submit" class="buttonsmall" value="SUBMIT">
</span></p>
</form>
</body>
<?
}
?>
</html>
Warning: move_uploaded_file(/home/virtual/site15/fst/var/www/html/ve/csv.csv): failed to open stream: Permission denied in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 33
Warning: move_uploaded_file(): Unable to move '/tmp/phpApwnRt' to '/home/virtual/site15/fst/var/www/html/ve/csv.csv' in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 33
Possible file upload attack! Here's some debugging info:
Array
(
[userfile] => Array
(
[name] => csv.csv
[type] => application/octet-stream
[tmp_name] => /tmp/phpApwnRt
[error] => 0
[size] => 88
)
)
Warning: fopen(): Unable to access csv.csv in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 47
Warning: fopen(csv.csv): failed to open stream: No such file or directory in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 47
Warning: file(): Unable to access csv.csv in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 49
Warning: file(csv.csv): failed to open stream: No such file or directory in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 49
Warning: fgetcsv(): supplied argument is not a valid stream resource in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 55
Warning: fclose(): supplied argument is not a valid stream resource in /home/virtual/site15/fst/var/www/html/ve/upload.php on line 67
===========================================
here is my upload file code
===========================================
<?php
$db = mysql_connect("localhost", "****","****");
mysql_select_db("*******",$db);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style10 { color: #FF0000;
font-weight: bold;
}
-->
</style>
</head>
<?
if(isset($_POST['submit']))
{
// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of
// $_FILES. In PHP earlier then 4.0.3, use copy() and is_uploaded_file()
// instead of move_uploaded_file
$uploaddir = '/home/virtual/site15/fst/var/www/html/ve/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
$row = 0;
$handle = fopen ("csv.csv","r");
$myfile = file("csv.csv");
$totallines = count($myfile);
$sql ="DELETE FROM jobs";
$result = mysql_query($sql);
while ($data = fgetcsv ($handle, 10000, ",")) {
$num = count ($data);
$row++;
$sql = "INSERT INTO jobs (name,pass) VALUES ('aa" .$data[1]. "','" .$data[2]. "')";
echo $row . " of " .$totallines . " added<br>";
$result = mysql_query($sql);
}
fclose ($handle);
}
else
{
?>
<body>
<form name="upload" method="POST" action="upload.php" enctype="multipart/form-data">
<p> </p>
<p align="center">
<input name="userfile" type="file" class="button" size="30">
</p>
<p align="center"><span class="style10">
<input name="submit" type="submit" class="buttonsmall" value="SUBMIT">
</span></p>
</form>
</body>
<?
}
?>
</html>