Hi Guys!

I'm having problem with uploading the file to the server. This is my code.

$path = "Files/01 Admin Procedure/" . basename($_FILES["txtFilename"]["name"]);

$x = move_uploaded_file($_FILES['txtFilename']['tmp_name'], $path);

//Move file to directory
if ($x) 
{   
    echo "<script>alert('File " . basename( $_FILES["txtFilename"]["name"]) . " has been uploaded!')</script>";
}
else
{
    echo "<script>alert('Error Uploading File! $path')</script>";
}

I'm having problem with uploading the file to the server.

What problem?

The code is working on my localhost but if I run in on the server, it does not upload the file, do I need to configure anything on php.ini? or in IIS?

Does the path have write access? Does the file size exceed the maximum as defined in the php.ini file?

How do I check if the path has access? This is on the server side.

Check permissions with cPanel or a decent FTP client.

I'm using IIS Sir.

Right click the folder, select properties and change the security permissions for iweb_user to desired CHMOD settings.

Got it already! You just need to change the permission settings of C:\Windows\Temp :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.