• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • 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

why
i am using windows vista
0
mgtm3
Asked:
mgtm3
  • 2
  • 2
2 Solutions
 
hernst42Commented:
what do you get if you add at the bginning of you page and upload again:
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
?>
0
 
mgtm3Author Commented:
i get the same thing
Error: A problem occurred during file upload!    
0
 
hernst42Commented:
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?
0
 
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
0
 
webjemaCommented:
Try to use absolute path in $newname
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

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