There was an error uploading the file, please try again!Error Code:6
up vote
1
down vote
favorite
We have a website using PHP 5.2 and it is hosted in Windows Plesk Server. We are now having issue in uploading any files via PHP. When we try to do so we are getting following error.
There was an error uploading the file, please try again!Error Code:6
upload_tmp_dir has local value "C:Inetpubvhostsxxxxxx.xxxhttpdocstmp" and master value "C:WindowsTemp" .
Can anyone suggest what should be the permission of these folders or do we need to check something else to fix this upload issue via PHP?
Here are the scripts I have used to test the Upload.
Script 1
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
</form>
</body>
</html>
<?PHP
if(!empty($_FILES['uploaded_file']))
$path = "newupload/";
$path = $path . basename( $_FILES['uploaded_file']['name']);
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path))
echo "The file ". basename( $_FILES['uploaded_file']['name']).
" has been uploaded";
else
echo "There was an error uploading the file, please try again!Error Code:". $_FILES['uploaded_file']["error"];;
?>
Script 2
<?php
echo '<form action="" method="post" enctype="multipart/form-data" name="uploader" id="uploader">';
echo '<input type="file" name="file" size="50"><input name="_upl" type="submit" id="_upl" value="Upload"></form>';
if( $_POST['_upl'] == "Upload" )
if(@copy($_FILES['file']['tmp_name'], $_FILES['file']['name'])) echo '<b>Upload SUKSES !!!</b><br><br>';
else echo '<b>Upload GAGAL !!!</b><br><br>';
?>
Script 1 gave the error "There was an error uploading the file, please try again!Error Code:6" . Script 2 showed upload success. But uploaded file was missing.
php windows plesk
add a comment |
up vote
1
down vote
favorite
We have a website using PHP 5.2 and it is hosted in Windows Plesk Server. We are now having issue in uploading any files via PHP. When we try to do so we are getting following error.
There was an error uploading the file, please try again!Error Code:6
upload_tmp_dir has local value "C:Inetpubvhostsxxxxxx.xxxhttpdocstmp" and master value "C:WindowsTemp" .
Can anyone suggest what should be the permission of these folders or do we need to check something else to fix this upload issue via PHP?
Here are the scripts I have used to test the Upload.
Script 1
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
</form>
</body>
</html>
<?PHP
if(!empty($_FILES['uploaded_file']))
$path = "newupload/";
$path = $path . basename( $_FILES['uploaded_file']['name']);
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path))
echo "The file ". basename( $_FILES['uploaded_file']['name']).
" has been uploaded";
else
echo "There was an error uploading the file, please try again!Error Code:". $_FILES['uploaded_file']["error"];;
?>
Script 2
<?php
echo '<form action="" method="post" enctype="multipart/form-data" name="uploader" id="uploader">';
echo '<input type="file" name="file" size="50"><input name="_upl" type="submit" id="_upl" value="Upload"></form>';
if( $_POST['_upl'] == "Upload" )
if(@copy($_FILES['file']['tmp_name'], $_FILES['file']['name'])) echo '<b>Upload SUKSES !!!</b><br><br>';
else echo '<b>Upload GAGAL !!!</b><br><br>';
?>
Script 1 gave the error "There was an error uploading the file, please try again!Error Code:6" . Script 2 showed upload success. But uploaded file was missing.
php windows plesk
There are two major problems here. (1) That is not a PHP native error; that's generated by whatever PHP code you are running. Without seeing that code, it's very hard to help you. If that error code is taken directly from the$_FILES
superglobal, then it corresponds toUPLOAD_ERR_NO_TMP_DIR
, meaning your temporary directory doesn't exist or has a permissions problem.
– Ed Cottrell♦
Nov 8 at 14:23
(2) PHP 5.2 is truly ancient. It was released more than 12 years ago and has been at end of life -- not even getting security updates -- for almost 8 years. Even the final version (5.2.17) has dozens of known vulnerabilities. You really need a plan to upgrade to at least 7.1.
– Ed Cottrell♦
Nov 8 at 14:23
I have tested the upload using two scripts. I will edit the question with those details also. Please do check.
– Arvin
Nov 8 at 14:42
I have edited question and added more details.
– Arvin
Nov 8 at 14:47
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
We have a website using PHP 5.2 and it is hosted in Windows Plesk Server. We are now having issue in uploading any files via PHP. When we try to do so we are getting following error.
There was an error uploading the file, please try again!Error Code:6
upload_tmp_dir has local value "C:Inetpubvhostsxxxxxx.xxxhttpdocstmp" and master value "C:WindowsTemp" .
Can anyone suggest what should be the permission of these folders or do we need to check something else to fix this upload issue via PHP?
Here are the scripts I have used to test the Upload.
Script 1
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
</form>
</body>
</html>
<?PHP
if(!empty($_FILES['uploaded_file']))
$path = "newupload/";
$path = $path . basename( $_FILES['uploaded_file']['name']);
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path))
echo "The file ". basename( $_FILES['uploaded_file']['name']).
" has been uploaded";
else
echo "There was an error uploading the file, please try again!Error Code:". $_FILES['uploaded_file']["error"];;
?>
Script 2
<?php
echo '<form action="" method="post" enctype="multipart/form-data" name="uploader" id="uploader">';
echo '<input type="file" name="file" size="50"><input name="_upl" type="submit" id="_upl" value="Upload"></form>';
if( $_POST['_upl'] == "Upload" )
if(@copy($_FILES['file']['tmp_name'], $_FILES['file']['name'])) echo '<b>Upload SUKSES !!!</b><br><br>';
else echo '<b>Upload GAGAL !!!</b><br><br>';
?>
Script 1 gave the error "There was an error uploading the file, please try again!Error Code:6" . Script 2 showed upload success. But uploaded file was missing.
php windows plesk
We have a website using PHP 5.2 and it is hosted in Windows Plesk Server. We are now having issue in uploading any files via PHP. When we try to do so we are getting following error.
There was an error uploading the file, please try again!Error Code:6
upload_tmp_dir has local value "C:Inetpubvhostsxxxxxx.xxxhttpdocstmp" and master value "C:WindowsTemp" .
Can anyone suggest what should be the permission of these folders or do we need to check something else to fix this upload issue via PHP?
Here are the scripts I have used to test the Upload.
Script 1
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
</form>
</body>
</html>
<?PHP
if(!empty($_FILES['uploaded_file']))
$path = "newupload/";
$path = $path . basename( $_FILES['uploaded_file']['name']);
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path))
echo "The file ". basename( $_FILES['uploaded_file']['name']).
" has been uploaded";
else
echo "There was an error uploading the file, please try again!Error Code:". $_FILES['uploaded_file']["error"];;
?>
Script 2
<?php
echo '<form action="" method="post" enctype="multipart/form-data" name="uploader" id="uploader">';
echo '<input type="file" name="file" size="50"><input name="_upl" type="submit" id="_upl" value="Upload"></form>';
if( $_POST['_upl'] == "Upload" )
if(@copy($_FILES['file']['tmp_name'], $_FILES['file']['name'])) echo '<b>Upload SUKSES !!!</b><br><br>';
else echo '<b>Upload GAGAL !!!</b><br><br>';
?>
Script 1 gave the error "There was an error uploading the file, please try again!Error Code:6" . Script 2 showed upload success. But uploaded file was missing.
php windows plesk
php windows plesk
edited Nov 8 at 14:46
asked Nov 8 at 14:17
Arvin
256
256
There are two major problems here. (1) That is not a PHP native error; that's generated by whatever PHP code you are running. Without seeing that code, it's very hard to help you. If that error code is taken directly from the$_FILES
superglobal, then it corresponds toUPLOAD_ERR_NO_TMP_DIR
, meaning your temporary directory doesn't exist or has a permissions problem.
– Ed Cottrell♦
Nov 8 at 14:23
(2) PHP 5.2 is truly ancient. It was released more than 12 years ago and has been at end of life -- not even getting security updates -- for almost 8 years. Even the final version (5.2.17) has dozens of known vulnerabilities. You really need a plan to upgrade to at least 7.1.
– Ed Cottrell♦
Nov 8 at 14:23
I have tested the upload using two scripts. I will edit the question with those details also. Please do check.
– Arvin
Nov 8 at 14:42
I have edited question and added more details.
– Arvin
Nov 8 at 14:47
add a comment |
There are two major problems here. (1) That is not a PHP native error; that's generated by whatever PHP code you are running. Without seeing that code, it's very hard to help you. If that error code is taken directly from the$_FILES
superglobal, then it corresponds toUPLOAD_ERR_NO_TMP_DIR
, meaning your temporary directory doesn't exist or has a permissions problem.
– Ed Cottrell♦
Nov 8 at 14:23
(2) PHP 5.2 is truly ancient. It was released more than 12 years ago and has been at end of life -- not even getting security updates -- for almost 8 years. Even the final version (5.2.17) has dozens of known vulnerabilities. You really need a plan to upgrade to at least 7.1.
– Ed Cottrell♦
Nov 8 at 14:23
I have tested the upload using two scripts. I will edit the question with those details also. Please do check.
– Arvin
Nov 8 at 14:42
I have edited question and added more details.
– Arvin
Nov 8 at 14:47
There are two major problems here. (1) That is not a PHP native error; that's generated by whatever PHP code you are running. Without seeing that code, it's very hard to help you. If that error code is taken directly from the
$_FILES
superglobal, then it corresponds to UPLOAD_ERR_NO_TMP_DIR
, meaning your temporary directory doesn't exist or has a permissions problem.– Ed Cottrell♦
Nov 8 at 14:23
There are two major problems here. (1) That is not a PHP native error; that's generated by whatever PHP code you are running. Without seeing that code, it's very hard to help you. If that error code is taken directly from the
$_FILES
superglobal, then it corresponds to UPLOAD_ERR_NO_TMP_DIR
, meaning your temporary directory doesn't exist or has a permissions problem.– Ed Cottrell♦
Nov 8 at 14:23
(2) PHP 5.2 is truly ancient. It was released more than 12 years ago and has been at end of life -- not even getting security updates -- for almost 8 years. Even the final version (5.2.17) has dozens of known vulnerabilities. You really need a plan to upgrade to at least 7.1.
– Ed Cottrell♦
Nov 8 at 14:23
(2) PHP 5.2 is truly ancient. It was released more than 12 years ago and has been at end of life -- not even getting security updates -- for almost 8 years. Even the final version (5.2.17) has dozens of known vulnerabilities. You really need a plan to upgrade to at least 7.1.
– Ed Cottrell♦
Nov 8 at 14:23
I have tested the upload using two scripts. I will edit the question with those details also. Please do check.
– Arvin
Nov 8 at 14:42
I have tested the upload using two scripts. I will edit the question with those details also. Please do check.
– Arvin
Nov 8 at 14:42
I have edited question and added more details.
– Arvin
Nov 8 at 14:47
I have edited question and added more details.
– Arvin
Nov 8 at 14:47
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53209605%2fthere-was-an-error-uploading-the-file-please-try-againerror-code6%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
There are two major problems here. (1) That is not a PHP native error; that's generated by whatever PHP code you are running. Without seeing that code, it's very hard to help you. If that error code is taken directly from the
$_FILES
superglobal, then it corresponds toUPLOAD_ERR_NO_TMP_DIR
, meaning your temporary directory doesn't exist or has a permissions problem.– Ed Cottrell♦
Nov 8 at 14:23
(2) PHP 5.2 is truly ancient. It was released more than 12 years ago and has been at end of life -- not even getting security updates -- for almost 8 years. Even the final version (5.2.17) has dozens of known vulnerabilities. You really need a plan to upgrade to at least 7.1.
– Ed Cottrell♦
Nov 8 at 14:23
I have tested the upload using two scripts. I will edit the question with those details also. Please do check.
– Arvin
Nov 8 at 14:42
I have edited question and added more details.
– Arvin
Nov 8 at 14:47