file upload-problem: my computer sometimes blocks 
Author Message
 file upload-problem: my computer sometimes blocks
Hi
 i'm trying to do a program to upload picture:
to learn i got a file from a site.
When i tried to use it: sometimes it works and sometimes it block my
computer and i have to reboot.
What could it be?
It happenes with different sizes (also small files) and sometimes it
saves immediately a larger file
This is the program:
What could it be the problem?
Can i use a timeout to interrupt the script execution?
Thank you very much!!

<?php

if ($HTTP_POST_VARS['submit']) {

$tipo=$HTTP_POST_FILES['file']['type'];
  echo "il tipo di file e': $tipo";

  print_r($HTTP_POST_FILES);
  if (!is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])) {
    $error = "You did not upload a file!";
    unlink($HTTP_POST_FILES['file']['tmp_name']);
    // assign error message, remove uploaded file, redisplay form.
  } else {
    //a file was uploaded
    $maxfilesize=102400;

    if ($HTTP_POST_FILES['file']['size'] > $maxfilesize) {
      $error = "file is too large";
      unlink($HTTP_POST_FILES['file']['tmp_name']);
          exit;
      // assign error message, remove uploaded file, redisplay form.
    }
        else {
      if ($HTTP_POST_FILES['file']['type'] != "image/gif" AND
$HTTP_POST_FILES['file']['type'] != "image/pjpeg" ) {
        $error = "This file type is not allowed";
        unlink($HTTP_POST_FILES['file']['tmp_name']);
                exit;
        // assign error message, remove uploaded file, redisplay form.
      }
          else {
       //File has passed all validation, copy it to the final
destination and remove the temporary file:
       copy($HTTP_POST_FILES['file']['tmp_name'],"/home/panauto/html/images/".$HTTP_POST_FILES['file']['name']);
       unlink($HTTP_POST_FILES['file']['tmp_name']);
       print "File has been successfully uploaded!";
       exit;
     }
    }
  }

Quote:
}

?>

<html>
<head></head>
<body>
<form action="<?=$PHP_SELF?>" method="post"
enctype="multipart/form-data">
<?=$error?>
<br><br>
Choose a file to upload:<br>
<input type="file" name="file"><br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>



Mon, 17 Oct 2005 09:11:55 GMT  
 file upload-problem: my computer sometimes blocks
sunnyspring was scribbeling:

Quote:
> When i tried to use it: sometimes it works and sometimes it block my
> computer and i have to reboot.


like a disk problem.

hth andreas
--
collect xul annotations: http://xul.andreashalter.ch/



Mon, 17 Oct 2005 14:24:03 GMT  
 file upload-problem: my computer sometimes blocks
It was a great new for me: thank you very much!!
Since i was sure the script was ok i searched other causes and i
thought to zone alarm. I didn't use it anymore but i think sometimes
there were some still active services.So i unistall it and now it
works perfectly. Cool thanks!!


Mon, 17 Oct 2005 21:00:06 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. file uploads/downloads from/to user's computer

2. File Upload Problems with binary files (ASCII works ok)

3. Block argument scoping must be ugly sometimes, David!

4. Dr. Seuss Explains Why Computers Sometimes Crash

5. Loops, sometimes it works, sometimes not.

6. Uploading Data from BASIC file Problem

7. file upload problem

8. file size upload problem

9. PHP Expert needs help with file upload problem: permission denied

10. Problem while uploading a binary file using cgi module

11. File Upload Problems

12. NEWBIE: File upload problems

 

 
Powered by phpBB® Forum Software