file upload problem

Posted on 2008-06-12
Medium Priority
Last Modified: 2008-06-13
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
Question by:mgtm3
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 48

Accepted Solution

hernst42 earned 1000 total points
ID: 21770436
what do you get if you add at the bginning of you page and upload again:
ini_set('display_errors', true);

Author Comment

ID: 21770511
i get the same thing
Error: A problem occurred during file upload!    
LVL 48

Expert Comment

ID: 21770551
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?

Author Comment

ID: 21770604
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

Assisted Solution

webjema earned 1000 total points
ID: 21777105
Try to use absolute path in $newname

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question