pmzq Posted July 22, 2007 Share Posted July 22, 2007 Hy all I got the following code for upload foto's to my server: $user = $_COOKIE['Username']; $pass = $_COOKIE['Password']; $foto_plaats = "../hugo/foto/"; $db = mysql_pconnect ("localhost:3306", root) or die ("Could not connect to database"); mysql_select_db(foto,$db); $send = $_POST['send']; $foto = $_POST['foto']; $delete = $_POST['delete']; $ja = $_POST['ja']; $nee = $_POST['nee']; // check the user! require "auth.php"; pre_auth($user,$pass); $naam = $HTTP_POST_FILES['mijnbestand']['name']; $type = $HTTP_POST_FILES['mijnbestand']['type']; $size = $HTTP_POST_FILES['mijnbestand']['size']; if ($naam){ // we stellen de maximale omvang in op 100kb $max = 1000000; // Als de bestandsgrootte groter is dan de maximale grootte dan….. if ($HTTP_POST_FILES['mijnbestand']['size'] > $max) { // als ie dus groter is echo'en we een error echo "Het bestand is groter dan 1Mb !!"; } // anders gaan we het bestand uploaden else { //zoals je ziet doen we dat met de functie copy() move_uploaded_file($HTTP_POST_FILES['mijnbestand']['tmp_name'], $foto_plaats . $HTTP_POST_FILES['mijnbestand']['name']); //en we echo'en nog even een berichtje //dat het bestand is geupload // Content type header('Content-type: image/jpeg'); echo "<center>Je hebt net het bestand $naam met succes geupload</center>"; // zet de naam van het bestand in de database mysql_query("insert into foto set foto='$naam'"); if ($HTTP_POST_FILES['mijnbestand']['name']=="none" OR $HTTP_POST_FILES['mijnbestand']['name']="") { //no file uploaded echo "<center>Je hebt geen foto geselecteerd</center>"; } It will upload the photo file and it will insert it's name in a database. The problem I have is that when I upload a photo1 which properties are: Width = 2048px, Height = 1536px and is 623kb everything works fine. When I try to upload another picture photo2 which properties are: Width = 600, Height = 400px and is 173kb it doesnt work my browser times out after a certain time and the image is not uploaded ? Can someone please help me figure this problem out ? I contacted my hosting provider and the max upload file size is a couple MB's so that's not it also the memmory is set to 16MB for me! Pls I'm hanging on this for days Greetzz pMzQ, Quote Link to comment Share on other sites More sharing options...
pmzq Posted July 22, 2007 Author Share Posted July 22, 2007 Could it be something to do with the server ? is it likely ? Sometimes it works sometimes it doesn't ? I figured out that the max dimension to upload was a width of 3000 px when i made it 3001 it didn't work anymore I just resized a red box and figured it out! help help help ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.