Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

file upload problem

Posted on 2008-06-12
5
Medium Priority
?
229 Views
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

why
i am using windows vista
0
Comment
Question by:mgtm3
  • 2
  • 2
5 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 1000 total points
ID: 21770436
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
 

Author Comment

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

Expert Comment

by:hernst42
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?
0
 

Author Comment

by:mgtm3
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
0
 
LVL 1

Assisted Solution

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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

916 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