Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002
    Posts
    50

    Exclamation Unanswered: php file upload problem

    Hello guys

    I'm trying to upload a file from a page form.php

    FORM.PHP

    Select the file :
    <FORM ACTION="upload.php" METHOD=POST ENCTYPE="multipart/form-data">
    File:
    <INPUT TYPE=FILE NAME="myfile" SIZE=60>
    <BR>
    <INPUT TYPE=SUBMIT NAME="SUBMIT" VALUE="Continue &gt;&gt;">
    </FORM>

    UPLOAD.PHP

    <?php
    $sample_file = $myfile;
    $sample_file_size = $myfile_size;
    $sample_file_name = $myfile_name;
    $sample_file_type = $myfile_type;
    if ($sample_file)
    {
    print ("File name: $sample_file_name<P>\n");
    print ("File size: $sample_file_size<P>\n");
    if (!is_dir ("/tmp/SampleSheets"))
    {
    echo "Creating temporary directory....<BR>\n";
    mkdir ("/tmp/myfiles", 0700);
    }
    if (copy ($sample_file, "/tmp/myfiles/$sample_file_name"))
    {
    $working_sample_file = "/tmp/myfiles/$sample_file_name";
    print ("Your sample file was successfully uploaded!<P>\n");
    } else
    {
    print ("Your sample file could not be copied.<P>\n");
    }
    unlink ($sample_file);
    }
    ?>

    now the problem is.. anything below 4 kb.. gets uploaded.. and it gives me the message "Your sample file was successfully loaded"

    but when the file size is above 4 kb.. it does nothing. It doesn't even give me any error. like "your sample file could not be copied".. or could not be uploaded.

    can somebody tell me what am i doing wrong?

    Thanks in Advance
    Deep

  2. #2
    Join Date
    Jul 2004
    Posts
    4

    Lightbulb

    <?php
    $sample_file_size = $myfile_size;
    if ($sample_file_size < 4000)
    echo ' < 4 kb';
    else
    echo 'Forbidden';
    ?>

  3. #3
    Join Date
    Nov 2002
    Posts
    50
    Quote Originally Posted by braw
    <?php
    $sample_file_size = $myfile_size;
    if ($sample_file_size < 4000)
    echo ' < 4 kb';
    else
    echo 'Forbidden';
    ?>
    hello braw

    thanks for the quick reply

    I dont want to display an error saying that its less then 4 kb. I have files that are over 4 kb which I would like to upload. why wouldn't it let me upload file over 4 kb?

    Thanks again
    Deep

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •