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.










share|improve this question























  • 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










  • 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














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.










share|improve this question























  • 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










  • 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












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.










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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










  • 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











  • (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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














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














































































Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)