Rahul Singh
Rahul Singh

Reputation: 1632

Error in picture uploading

I have already created directory at location 'cms/user/prescriptionimg' But I am getting error in uploading file.

 Warning: move_uploaded_file(../cms/user/prescriptionimg/11500004-21000002-13165874331.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/oxfordmo/public_html/cms/user/prescription.php on line 113

 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpdCWdaR' to '../cms/user/prescriptionimg/11500004-21000002-13165874331.jpg' in /home/oxfordmo/public_html/cms/user/prescription.php on line 113

 Unable to move user 11500004-21000002-13165874331's picture to prescription directory

Script regarding this is...

  if (file_exists("../cms/user/prescriptionimg/$username.$ext")) 
    {unlink("../cms/user/prescriptionimg/$username.$ext"); }
  if (!move_uploaded_file($_FILES["scaninput".$i]['tmp_name'],"../cms/user/prescriptionimg/$username.$ext")) 
            { die("Unable to move user $username's picture to prescription directory"); }

Upvotes: 0

Views: 49

Answers (1)

Sankalp
Sankalp

Reputation: 1350

use this function to retrieve root path.

 $root = realpath($_SERVER["DOCUMENT_ROOT"]);


                  //-----------------------------------
                  // require the functions file
                  //-----------------------------------
                  //require ("$root/php/funkshions.php");

Upvotes: 1

Related Questions