Avatar of bbrunning
Flag for United States of America

asked on 

php upload script not working

Here's the code I put in my index.php file:
    if(move_uploaded_file($_FILES['upload']['tmp_name'], "/var/www/virtual/globalsourcingintl.com/upload/htdocs/uploads/$_FILES[upload]['name]"))
    echo "File uploaded successfully";
    else echo "Problem uploading file";

<form action="" method="post" enctype="multipart/form-data">
<p>Select file to upload<input type="file" name="upload" /></p>
<input type="submit" value="Upload" />

I cannot get this to work. This is a dedicated server running ubuntu, I have 2 domains and a subdomain. The subdomain is where the upload script is: upload.globalsourcingintl.com. The absolute path to the upload directory is /var/www/virtual/globalsourcingintl.com/upload/htdocs/uploads/
But that's the path when I'm logged in as root under ssh. Everytime I try to upload something I get the else error.
Another thing: I have the subdomains main directory protected using .htaccess and .htpasswd, I am logged in before actually trying to upload the files.

Any Ideas?
PHPScripting Languages

Avatar of undefined
Last Comment

8/22/2022 - Mon