Jump to content

Search the Community

Showing results for tags '$_FILES'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 1 result

  1. I have got some frustating problems facing file upload with a php script. The problem is that my script is working on my local xampp server. But when I transfer it to my strato host server it won't work anymore. There is no error output, although I have set display_errors to on and error_reporting to E_ALL. Here is my complete code which I copied from the w3school file upload tutorial and is stored in the file upload.php: <?php $target_dir = "./uploads"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if(isset($_POST["submit"])) { print_r($_FILES); $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } // Check if file already exists if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 500000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (copy($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } } ?> <!DOCTYPE html> <html> <body> <form action="upload.php" method="post" enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload Image" name="submit"> </form> </body> </html> The output of the script after every submission is: As you can see the $_FILES array is completly empty.. no matter what type of file I upload. I checked my php.ini and also phpinfo() for the relevant configuration parameters. This is what I got: file_uploads = On; memory_limit = 128M; post_max_size = 128M; upload_max_filesize = 128M; upload_tmp_dir = /tmp; The files I tried to upload of course did not exceed the limit of 128MB. The script itself should not cause my problem, since it works on my local XAMPP server and for many other users and servers. There must be something wrong with my strato server configuration, but I can't figure out what the problem is. The php.ini seems wright. Does anybody have an idea, a clue or maybe just a hint? Thanks in Advance.
×
×
  • Create New...