Ammendment:
Actually, I was just looking at one of my photoupload processes and I
actually removed the MAX_FILE out of the upload form and only tested the
file size on the processing page like in the previous message.

Cheers, Joe :)


"Lerp" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Jim, here's how I do it. I test for the file size on the processing
page
> as well, if it's too large I redraw out the upload form.
>
>
> file://test for file extension type if needed
>
>
>
> file://determine file size -- if too big ( greater 50kb) then redirect
> $siz = filesize($userfile);
>
> if ($siz >= 51200){
>
> file://redraw upload form
> print "<font face='verdana' size='2' class='text_size_9'>The photo you
> attempted to upload was too large in file size. Please ensure that the
file
> size does not exceed 50kb.</font>";
> print "<form method='POST' action='photoupload.php'
> enctype='multipart/form-data'><input type='hidden' name='MAX_FILE_SIZE'
> value='51200'>
> <input type='file' name='userfile' size='15' style='font-family: Verdana;
> font-size: 8pt;'><input type='submit' name='submit' value='Upload'
> style='font-family: Verdana; font-size: 8pt;'>";
> print "</form>";
>
> }
> elseif ($siz < 51200)
> {
>
>  $timestamp = time();
>  $userfile_name = $timestamp.$userfile_name ;
>
>  // copy the file being posted
>  if(copy($userfile, "/dir/dir/pics/". $userfile_name)){
>  print "<font face='verdana' size='2' class='text_size_9'>Your photo has
> been uploaded and is viewable in the photo gallery.</font><br><br>" ;
>  }
>  else
>  {
>  print "<font face='verdana' size='2' class='text_size_9'>A problem was
> encountered during your photo upload.</font><br>";
>  }
>
> $patharola = "pics/". $userfile_name;
>
>
> file://connect to db
> $connectionToDBid = odbc_connect("dgsff", "sdgsdfg", "sdfgsdfg");
>
> file://create query statement
> $sqlr = "INSERT INTO PHOTO (golferid, photo, caption, datesubmitted)
VALUES
> ('$sesgolferid' , '$patharola', '$caption', '$todaysdate' )";
> file://execute the sql statement (query) on the connection made
> $resultset = odbc_do($connectionToDBid, $sqlr);
>
> blah blah blah ...
>
>
> Hope this helps you out, Joe :)
>
>
>
>
> "Jim Koutoumis" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Joe,
> >
> > Do you know when the file size is checked ??
> >
> > I think it only gets checked after the form is posted and file uploading
> is
> > finished ??
> >
> > I don't know how it's possible to catch things before user uploads - now
> > that would be neat :-)
> >
> > Jim.....
> >
> > "Lerp" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Hi there :) Did you set a max file size in your upload form? See my
form
> > > below, notice the 'MAX_FILE_SIZE' value='102400' part within hidden
> field.
> > > This should appear before the rest of the form. You can adjust this
> value
> > as
> > > you wish.
> > >
> > >
> > > <form action='resumeupload.php' method='post'
> > enctype='multipart/form-data'>
> > >                 <input type='hidden' name='MAX_FILE_SIZE'
> value='102400'>
> > >                 <font color='#663399' face='verdana' size=2><b>Upload
> > > Resume:</b></font>
> > >                 <input type='file' name='userfile'
> > style='background-color:
> > > #FFFFFF; font-family: verdana; font-weight: bold; color: #9999FF;
> > font-size:
> > > 9pt;'>
> > >                 <input type='submit' value='Upload!!!'
> > > style='background-color: #FFFFFF; font-family: verdana; font-weight:
> bold;
> > > color: #9999FF; font-size: 9pt;' name="submit">
> > >               </form>
> > >
> > >
> > > Hope this helps, Joe :)
> > >
> > >
> > >
> > > "Chuck "Pup" Payne" <[EMAIL PROTECTED]> wrote in message
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > Hi,
> > > >
> > > > I am trying to set a small script that would let my clients upload
> file
> > > with
> > > > a Explorer or Netscape, but the problem is it would let me upload
any
> > file
> > > > that is great than a 1MB. We get an error that the file "none" could
> not
> > > be
> > > > read.
> > > >
> > > > I have set the upload_tmp_dir=/tempupload is has been chmod to 777,
> > > php.ini
> > > > as been set to 20MB, I know that is a lot but we are engingeering
> > company
> > > > that work with CADD files.
> > > >
> > > > Any clues where to look? The PHP 4 Bible from IDG states that we
have
> to
> > > > under HTTP uploads, but nothing else. Is there some where on the net
> > that
> > > > explains better what I have to set up, turn on, or haven't done?
> > > >
> > > > Thanks,
> > > >
> > > > Chuck
> > > >
> > >
> > >
> >
> >
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to