Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #17836

Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo

From Lew Pitcher <lew.pitcher@digitalfreehold.ca>
Newsgroups comp.lang.php
Subject Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo
Followup-To comp.lang.php
Date 2018-12-14 17:07 -0500
Organization The Pitcher Digital Freehold
Message-ID <pv19jq$3rg$1@dont-email.me> (permalink)
References <4afe4c5b-25d8-4c61-ba76-1fb45b1d1203@googlegroups.com> <5c141a5a$0$22349$e4fe514c@news.xs4all.nl> <89fa34e7-c2fd-4853-8b45-4ecd194fc905@googlegroups.com>

Followups directed to: comp.lang.php

Show all headers | View raw


Dan Campbell wrote:

> On Friday, December 14, 2018 at 4:02:23 PM UTC-5, Luuk wrote:
>> On 14-12-2018 21:44, Dan Campbell wrote:
>> > Hi,
>> > 
>> > I’m having a problem retrieving errors about a specific file upload, in
>> > a range of 3 of them.
>> > 
>> > They are all single input file blocks, none of them multiple. It’s a
>> > SINGLE Submit to e.g. add_uploads.php .
>> > 
>> > The problem is that the $_FILES array is empty, whenever at least ONE
>> > of the file uploads has a problem.
>> > 
>> > 
>> > So if 2 of the files are ok, but 1 of the files is too large for the
>> > maximum setting, then error relating to that specific file is
>> > unavailable.
>> > 
>> > Now, php_errormsg contains an appropriate error message. But it doesn’t
>> > indicate WHICH file upload was unsuccessful.
>> > 
>> > 
>> > (How do you apply code formatting, for php or html fragments?)
>> > 
>> > 
>> > <form action="./add_uploads.php" method="post"
>> > enctype="multipart/form-data">
>> > 
>> > 

HTML fragment restored:
> <form action="./add_uploads.php" method="post"
> enctype="multipart/form-data">
> 
> 
> /*
> ...
> ...
> ...
> 
> */
> 
> 
> <tr>
>   <td>
>       <label for="id-photo-id">Photo ID</label>
>   </td>
>   <td>
>       <input type="file" name="nme-photo-id" id="id-photo-id"
>       accept=".jpg, .png, .jpeg, .gif, .bmp, .pdf" />
>   </td>
> </tr>
> <tr>
>   <td>
>       <label for="id-application">Application</label>
>   </td>
>   <td>
>       <input type="file" name="nme-application" id="id-application" 
>       accept=".jpg, .png, .jpeg, .gif, .bmp, .pdf" />
>   </td>
> </tr>
> 
> <tr>
>   <td>
>       <label for="id-photo">Photo</label>
>   </td>
>   <td>
>       <input type="file" name="nme-photo" id="id-photo"  accept=".jpg,
>       .png, .jpeg, .gif, .bmp, .pdf" />
>   </td>
> </tr>


>> 
>> This is comp.lang.php, so people reading here are far more interested in
>> the PHP that's in 'add_uploads.php', than the HTML-code i wiped... ;)
> 
> When we step througo to the very top of that file, on the very first code
> line $s_Error = $php_errormsg, the $_FILES array is empty, if there's an
> error in any of the uploads.
> 
> So the rest doesn't really matter.
> 
> 
> <?php
> 
> 
> 
>             $s_Error = $php_errormsg ;
> 
>             $s_TemporaryDirectory = sys_get_temp_dir() ;
> 
>             include 'login_inc.php' ;
>             include 'CheckImages.php' ;
>             include 'udfs.php' ;
> 
>             $s_DocumentRoot = $_SERVER['DOCUMENT_ROOT'] ;
> 
>             set_error_handler( "handleError" );
> ...
> ...
> ...

Have you tried examining the $_FILES global variable?
According to the PHP documentation
 at http://php.net/manual/en/features.file-upload.post-method.php
your form handler should be able to examine
  $_FILES['nme-photo-id']['error'] for upload errors on nme-photo-id,
  $_FILES['nme-application']['error'] for upload errors on nme-application, 
and
  $_FILES['nme-photo']['error'] for upload errors on nme-photo

HTH
-- 
Lew Pitcher
"In Skills, We Trust"

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Cannot retrieve error related to a specific file upload, in a 3-part input file blo Dan Campbell <dcwhatthe@gmail.com> - 2018-12-14 12:44 -0800
  Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Luuk <luuk@invalid.lan> - 2018-12-14 22:02 +0100
    Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Dan Campbell <dcwhatthe@gmail.com> - 2018-12-14 13:45 -0800
      Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2018-12-14 17:07 -0500
      Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Luuk <luuk@invalid.lan> - 2018-12-15 11:15 +0100
        Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Dan Campbell <dcwhatthe@gmail.com> - 2018-12-15 05:50 -0800
          Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Luuk <luuk@invalid.lan> - 2018-12-15 16:03 +0100
            Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Dan Campbell <dcwhatthe@gmail.com> - 2018-12-15 09:42 -0800
              Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Luuk <luuk@invalid.lan> - 2018-12-15 20:01 +0100
            Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Arno Welzel <usenet@arnowelzel.de> - 2018-12-16 02:11 +0100
              Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Luuk <luuk@invalid.lan> - 2018-12-16 14:22 +0100
                Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Dan Campbell <dcwhatthe@gmail.com> - 2018-12-16 11:05 -0800
              Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Dan Campbell <dcwhatthe@gmail.com> - 2018-12-16 11:02 -0800
              Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-12-16 23:30 +0100
                Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Dan Campbell <dcwhatthe@gmail.com> - 2018-12-16 15:15 -0800
              Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Dan Campbell <dcwhatthe@gmail.com> - 2018-12-17 07:01 -0800
                Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Dan Campbell <dcwhatthe@gmail.com> - 2019-01-29 07:06 -0800
                Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo bill <william@TechServSys.com> - 2019-01-30 06:43 -0500
  Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Dan Campbell <dcwhatthe@gmail.com> - 2018-12-14 13:42 -0800
    Re: Cannot retrieve error related to a specific file upload, in a 3-part input file blo Jerry Stuckle <jstucklex@attglobal.net> - 2018-12-16 12:45 -0500

csiph-web