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
Share on other sites

I tried it with a different picture now properties of this pic are: Width = 1280, Height = 1024 and it is 400 kb big it seams to work endlessly times ?

 

And yes this is the code that is uploading the image

Link to comment
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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.