• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

file upload problem

i am tring to upload file to the upload folder but it wont let me

this is the code

$newname = 'upload/'.$name;
if (!file_exists($newname)) {
        //Attempt to move the uploaded file to it's new place
        if ((move_uploaded_file($tmplocation,$newname))) {
           echo "It's done! The file has been saved as: ".$newname;
        } else {
           echo "Error: A problem occurred during file upload!      

i get
Error: A problem occurred during file upload!     i get

i am using windows vista
  • 2
  • 2
2 Solutions
what do you get if you add at the bginning of you page and upload again:
ini_set('display_errors', true);
mgtm3Author Commented:
i get the same thing
Error: A problem occurred during file upload!    
No php warning error inside you script? Are you sure $tmplocation is a valid file and $newname is a directory where the webserver is able to write to?
mgtm3Author Commented:
i am wrking with localhost
i am hosting the files in my pc
and i am sure that $tmplocation have the name of the file
and that where the script is there is a folder named upload
Try to use absolute path in $newname
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now