Jump to content

error when trying to upload a file


mistermister

Recommended Posts

when im trying to upload a file i get this error message and i dont know why i think every thing is ok with my code there is the error and the the code

 

Warning:  move_uploaded_file(3/New Text Document.txt) [function.move-uploaded-file]: failed to open stream: No such file or directory in /var/www/localhost/inside/addCustomerDocumentDone.php on line 31

 

 

$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

 

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {

  echo "<html>

            <head>

                <title>Create a task</title>

                <link rel='stylesheet' type='text/css' href='CRMstyle.css' />

            </head>

        <body>

            <h5>File is valid, and was successfully uploaded.</h5>

                                          .

                                          .

                                          .

                                          .

                                          .

 

and this is my upload dir

$uploaddir    = "/var/www/localhost/inside/customersdocs/";

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/43344-error-when-trying-to-upload-a-file/
Share on other sites

try giving it a new filename(use some session variable or something)

like:

$filename = $_SESSION['username']. substr($_FILES['userfile']['name'], -4);
$uploaddir    = "customersdocs/";

$rez = move_uploaded_file($_FILES['fileUpload']['tmp_name'], $tempres);
if($rez)
{
......
}

 

or perhaps try this:

$uploaddir    = "customersdocs/";

thats if your file is within inside

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.