Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9171069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:06:46+00:00 2026-06-17T16:06:46+00:00

PHP code: $target_path=’uploads/’; //$target_path=$target_path.basename($_FILES[‘photo’][‘name’]); $res=move_uploaded_file($_FILES[‘photo’][‘tmp_name’],$target_path); if($res) //perform insert query else //echo ‘file not uploaded’;

  • 0

PHP code:

$target_path='uploads/';
//$target_path=$target_path.basename($_FILES['photo']['name']);
$res=move_uploaded_file($_FILES['photo']['tmp_name'],$target_path);
if($res)
//perform insert query
else
//echo 'file not uploaded';

HTML code:

<td colspan="3"> <input type="file" name="photo" id="photo"> </td>

After execution the image file is not moved to target_path folder. Also, The value of $res remains empty.

I need the value of $res as i want to perform insertion query if the variable has “true” as value.

There are no errors in the uploaded file. It exists and so does the target_path. There is no file with same name in target_path folder either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:06:47+00:00Added an answer on June 17, 2026 at 4:06 pm

    i simply used copy() instead of move_uploaded_files and it worked. Note that i don’t have enctype mentioned in my form. Don’t know if that was the cause move_uploaded_files wasn’t working. But copy() definitely works without it.

    Also consider what oldskool commented above

    “$_FILES[‘photo’][‘tmp_name’] will hold the full path to the upload, something like /tmp/asx823ASDfg, so using this syntax will result /upload//tmp/asx823ASDfg, which is an absolute path to a (most likely) unexisting folder. – Oldskool

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: function submitTwice(f){ f.action = 'http://mydomain.com/threevideopage.php'; f.target='name'; f.submit(); } I left
PHP code: echo date(c); //out put like this 2012-06-19T20:37:44+05:30 echo date(d M, Y); //out
PHP code: <a id=a$id onclick=check($id,1) href=javascript:void(0) class=black>Qualify</a> I want to remove the onclick=check($id,1) so
Having php code: function getChildren($parent_id = 0) { .... return $SomeChildrenArray; } And Smarty
My PHP code is: $query=select company_name from company_names where cik=.$cik; Which on printing gives
My PHP code $dom = new DOMDocument(); @$dom->loadHTML($file); $xpath = new DOMXPath($dom); $tags =
My PHP code is split between many files, and often I find myself using
My PHP code assigns an array to a Smarty variable that can be accessed
I'm writing a php code where the user enter various details and then submits
I have the following PHP code, and for the life of me I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.