Jump to content

Uploading same image fails the 3rd time ?


pmzq

Recommended Posts

I've got a photo uploading script to upload images to the webserver:

 

$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>";
}



} 
}

 

When I try to upload a picture with these properties: Width = 600px, Height = 400px and it's 80kb's.

 

Then the first time it works fine very fast it uploads. Second time works aswell. But then the 3rd time it keeps trying untill I get the browser error that the page couldn't be reached ?

 

Even when I shutdown my browser and try again it fails. Could it be something with the memory being full at the server or something ?

 

Does anyone have a clue where the flaw may be ? at the server or at the script or at my pc ?

 

Many thnx!

 

pMzQ,

Link to comment
https://forums.phpfreaks.com/topic/61323-uploading-same-image-fails-the-3rd-time/
Share on other sites

No there is no error message my browser just tells me that it can not reach the page after a long time...

 

The comments aren't very informative and the code isn't that hard it just does what it does upload the file and doesn't if the image is larger then $max...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.