http://www.perlmonks.org?node_id=701283

gilep has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I am trying to set up a site to design calendars using my users' pictures. In order to do that I have built a form that users can attach files to it and send it to my server (using form2mail CGI script attached below). It works well but only for small files. For large files (I need to upload up to 13 files, each can be up to 5 Mb) it crashes after an hour and no files are saved. My host replied to me that there is a timeout on the server that they do not wish to increase. Since the script works well for a single large file, my idea is to call it several times, and each time asks it to handle and upload only a single file. However, I want my users to fill the form and insert the names of the files they want to upload only once. So after the script is called the first time by the form, I need a way to call another script again (automatically, without user's intervention) and to pass the file names collected by teh first script to it. Since the script ends with calling an html thank you page, I though of using this page to call the second script using <meta HTTP-EQUIV="REFRESH" content="0; url=http://gilep.netfirms.com/cgi-bin/gilepf2mcalendar.pl"> This command does eth job but again I have no idea how to pass the information from one script to the other. The file names are stored in my @file_upload_fields. BTW, I have no programming expertise what so ever. Thanks for any help related to these issues. Thanks, Gil
  • Comment on Passing Data from One Script to Another

Replies are listed 'Best First'.
Re: Passing Data from One Script to Another
by CountZero (Bishop) on Jul 30, 2008 at 22:04 UTC
    BTW, I have no programming expertise what so ever.
    How do you think the scripts you need are going to be written? Perlmonks is a very friendly community and we do help even newbie users, but we expect them to have at least some programming knowledge and the willingness to invest time and effort in learning to program in Perl. We are not a "we write your programs for free" service.

    As to the form2mail CGI script, a quick Google search showed lots of "form2mail" scripts, many of which are not Perl-programs at all and all provide wildly different interfaces and functions. So from the info you gave, I cannot determine how to get the info from this script into another.

    Also a 'form2mail' program does not seem entirely well suited for uploading files. For that I would look for a program such as eUpload (although it is artifically limited to files of max. 25 kByte).

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: Passing Data from One Script to Another
by MidLifeXis (Monsignor) on Jul 30, 2008 at 21:48 UTC

    File upload fields in web forms are not allowed to be set by a remote machine (which is what you are asking to do), or http://somenastysite.example.com/ could force sending /etc/passwd or the like without the user even knowing it. The best I can think of suggesting is to create a session of sorts, upload the 13 files via AJAX, JSON, etc to that session, then call the calendar maker on that session.

    Unless you can restrict the picture size your customers are uploading (I have jpeg files that print well at 8x10 or higher at under 1MB), or relax your requirement for uploading all of the files from a single page, I cannot see an easy way to avoid some sort of dynamic processing of the files.

    --MidLifeXis

Re: Passing Data from One Script to Another
by injunjoel (Priest) on Jul 30, 2008 at 22:43 UTC
    Greetings,
    One possible quick solution would be to increase the size of incoming posts that get accepted... via $CGI::POST_MAX, though I am not sure that is the actual problem. limiting the incoming image sizes would be a good idea as well.

    -InjunJoel
    "I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo