Results 1 to 5 of 5

Thread: question about define("MAX_FILE_UPLOAD_SIZE",2048);

  1. #1
    Join Date
    Feb 2007
    Posts
    82

    Default question about "MAX_FILE_UPLOAD_SIZE",2048)how to add error alert for files too large

    I have been experimenting with my form and what will and will not submit and have found that the limit on my server (which is out of my control) is 2MB, any larger than that (up to a total limit of 8MB) the form goes ahead and submits but the user is not notified that the file was too large and was not uploaded.
    Once I get all the specifics ironed out I will post information alerts to let them know the max file size, but in case they don't pay attention, or don't realize their file is too large, is there an error I can associate with this to let the user know their file was not sent?


    Also I see that Russel posted this code about file upload criteria
    <input type="hidden" name="conditions1" value=":@
    @TEST@file1~/^.*\.pdf$/i@You can only upload PDFs@">


    but can the same sort of criteria be used when attaching to an email? I tried it as is and it doesn't seem to affect the attachment?

    my form: http://www.nmprc.state.nm.us/crdonlineform.htm
    you can test this form, the only recipient is me
    Last edited by kdeguero; 28-Dec-2007 at 07:17 PM. Reason: add url

  2. #2
    Join Date
    Feb 2007
    Posts
    82

    Default Re: question about define("MAX_FILE_UPLOAD_SIZE",2048);

    This is what I am trying to do, but I get no error and any file goes through. I do not know the exact syntax to use.

    my files are named upfile1 through upfile5

    <input type="hidden" name="conditions" value=":@
    @TEST@upfile#.*\.pdf$/i@You can only upload PDFs@:
    @TEST@upfile#<2048@Maximum file upload size is 2 megabytes.@"
    ">

    I just got this in my def alert :
    More information: Pattern operator "~" failed: pattern "/^.*\.pdf$/i", value searched was "".
    Last edited by kdeguero; 28-Dec-2007 at 08:00 PM. Reason: adding error msg

  3. #3
    Join Date
    Feb 2007
    Posts
    82

    Default Re: question about define("MAX_FILE_UPLOAD_SIZE",2048);

    well as the day slowly crawls by, I am making progress...I got it to reject an image file and accept a valid pdf file....but the size limit has got me.
    I think it is because of the server limitations, in my testing I have found that any file over 2mb gets rejected, and so I think when it contacts the server and rejects the file (ie the error message saying that there is no value to search). This means the code in the form is bypassed. Does anyone know how I can get it to give the person a message that their file was not uploaded because the server rejected it?
    Last edited by kdeguero; 28-Dec-2007 at 10:51 PM. Reason: more info as the troubleshooting progresses

  4. #4
    Join Date
    Feb 2007
    Posts
    82

    Default Re: question about define("MAX_FILE_UPLOAD_SIZE",2048);

    still wondering if there is anyway to get the form to check for the file size, before it goes to the server to check?

  5. #5
    Join Date
    Apr 2008
    Posts
    23

    Default Re: question about define("MAX_FILE_UPLOAD_SIZE",2048);

    The only way I can think that you could do that is use Javascript, which means that the browser would have to report / make the file size information available from the filesystem to javascript. As far as I know, this is not the case.

    See:

    http://w3schools.com/htmldom/dom_obj_fileupload.asp

    And there's no way for the server to be able to check the file size before you send all the data over . Even if you wanted to use AJAX, the javascript would have to send all the data over to the server to check it. The only thing I could think of that that might do better is interrupt the upload once it had sent more than the max size, and give the user a message, rather than waiting until either the whole file's been uploaded and checked, or the max_post_size has been exceeded.

    The only way I could think would be to see if Flash has some way of doing it, but then you're getting into a whole different ballgame ...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. No "Sender" of the email
    By lemonade in forum FormMail Subscription Support
    Replies: 1
    Last Post: 28-Jun-2004, 08:11 PM
  2. "Internal Server Error": What'd I do wrong?
    By sgodun in forum FormMail Subscription Support
    Replies: 4
    Last Post: 16-May-2004, 12:01 AM
  3. Spiders and "The form has an internal error"
    By russellr in forum FormMail Subscription Support
    Replies: 0
    Last Post: 13-May-2004, 09:11 PM
  4. Email contains no "mesg"
    By xuric in forum FormMail Subscription Support
    Replies: 1
    Last Post: 19-Apr-2004, 08:17 PM
  5. at mangle / e-mail question
    By Ibis in forum FormMail Subscription Support
    Replies: 3
    Last Post: 25-Feb-2004, 02:59 AM

Bookmarks

Posting Permissions

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