10 Replies Latest reply on Mar 21, 2008 8:45 AM by (mediaMan6476)

    Image Upload. File Type Input?

    Level 1
      I'm getting this error. "Error uploading file. No input of file type was submitted."

      Is it not finding the file extension on the file name?
        • 1. Re: Image Upload. File Type Input?
          The values of the PHP superglobal, $_FILES would help in deciphering what occurred within PHP. i.e., Was the image uploaded? Was there an error? ...

          <?php
            print "<pre>";
            print_r($_FILES);
            print "</pre>\n";
          ?>

          Using IIS this yields the following data on an example upload:

          $_FILES = Array
          (
            [file] => Array
            (
              [name] => Thumbs.db
              [type] => application/octet-stream
              [tmp_name] => C:\temp\php6BC.tmp
              [error] => 0
              [size] => 10240
            )
          )

          Also, where in the ADDT are you getting this error?
          • 2. Re: Image Upload. File Type Input?
            Level 1
            I first created an update form so that the admin can update certain records. But included on that same page is an image upload insert form. However i linked the update button to the insert form so there is an option to add a new image to the record.

            I did all this the wrong way I think. I should have used insert into two tables?

            I thought maybe i could just fix the image upload and everything would be okay.
            • 3. Re: Image Upload. File Type Input?
              Level 1
              The X/HTML <form /> element likely needs to have the following set:

                  enctype="multipart/form-data"

              Without that, the uploading of files does not work.

              Also, if the two forms are linked, then there should only be one X/HTML <form /> element on the page. You should not be taking elements from one form and using them in another as this does not work by default. Nonetheless, a single form can have multiple submit buttons with multiple actions resulting from different submissions.
              • 4. Re: Image Upload. File Type Input?
                Level 1
                Okay I'm further along but I have another error.

                Developer Details:
                File upload error: Error uploading file. Error moving uploaded file from temporary folder. (FILE_UPLOAD_ERROR)

                Its also giving me this from the hosting directory.

                Warning: unlink(c:\winnt\temp\php4\php5024.tmp) [function.unlink]: No such file or directory in D:\hshome\sweetlem\oiko.us\includes\common\lib\file_upload\KT_FileUpload.class.php on line 240

                When I upload the file. The entry is put into the database. And if the folder for the image to be stored in, isn't there, it creates it no problem.

                What's stopping the funcntion from going all the way through?
                • 5. Re: Image Upload. File Type Input?
                  Level 1
                  What are the permissions on the target directory? Does the web server account have write permissions to that directory?

                  You might try to manually create the destination directory and ensure that the web server account has permission to write to this directory. Also double check the permissions on an implicitly created target directory. You also need to look at the values in $_FILES to ensure the upload was successful before the error messages have meaning.

                  FYI, the unlink() command deletes a file.
                  • 6. Re: Image Upload. File Type Input?
                    Level 1
                    Okay, i deleted the folder that i created which had a permission of 777 I then ran the upload for the image and i got the same error. But it created the new folder and it still had 777 as the permissions.

                    Should i contact the web host or is this an addt problem still?
                    • 7. Re: Image Upload. File Type Input?
                      Level 1
                      tNG Execution Trace - VIEW

                      * tNG_insert.executeTransaction
                      o STARTER.Trigger_Default_Starter
                      o tNG_insert.doTransaction
                      + BEFORE.Trigger_Default_FormValidation
                      + BEFORE.Trigger_SetOrderField
                      + tNG_insert.prepareSQL + tNG_insert.executeTransaction - execute sql
                      + tNG_insert.postExecuteSql
                      + AFTER.Trigger_ImageUpload
                      # tNG_insert.afterUpdateField - file, granny_1600x1200_H.jpg
                      * tNG_update.executeTransaction
                      o STARTER.Trigger_Default_Starter
                      o tNG_update.doTransaction
                      + BEFORE.Trigger_Default_saveData
                      # tNG_update.saveData
                      + tNG_update.prepareSQL
                      + tNG_update.executeTransaction - execute sql
                      + AFTER.Trigger_LinkTransactions
                      # tNG_insert.doTransaction
                      * BEFORE.Trigger_Default_FormValidation
                      * BEFORE.Trigger_SetOrderField
                      * tNG_insert.prepareSQL
                      * tNG_insert.executeTransaction - execute sql
                      * tNG_insert.postExecuteSql

                      b * AFTER.Trigger_ImageUpload*

                      * ERROR.Trigger_Default_RollBack
                      * ERROR.Trigger_Default_Insert_RollBack
                      + ERROR.Trigger_LinkTransactions
                      * tNG_insert.getRecordset
                      * tNG_insert.getFakeRsArr
                      * tNG_insert.getLocalRecordset
                      * tNG_insert.getFakeRecordset
                      * tNG_insert.getFakeRecordset
                      * tNG_update.getRecordset
                      * tNG_update.getFakeRsArr
                      * tNG_update.getLocalRecordset
                      * tNG_update.getFakeRecordset
                      • 8. Re: Image Upload. File Type Input?
                        Level 1
                        Until you add the print statement for $_FILES and share that I am done helping on this. Ensuring that the file was correctly uploaded is always the first step in debugging this type of problem, and you have not provided that info and I cannot provide any additional insight without it. An improperly configured <form> element can cause uploads to fail and you have yet to share that this part works and diverging to other topics before ensuring step 1 is correct is almost never fruitful.
                        • 9. Re: Image Upload. File Type Input?
                          Level 1
                          I"ve fixed the solution thank you for all your help
                          • 10. Re: Image Upload. File Type Input?
                            I'm having this same problem. What was the fix here?

                            I checked perms on the target folder and the common/lib/file_upload/Temp folder which I had to create manually and chmoded to 777 as that has fixed this problem on some other sites.

                            Also I have the enctype="multipart/form-data" set in my form and there is only one form in the page.

                            Here is the output of my $_FILES var

                            Array
                            (
                            [image_url] => Array
                            (
                            [name] => BIOPIC.jpg
                            [type] => image/jpeg
                            [tmp_name] => /tmp/phpdbaVLC
                            [error] => 0
                            [size] => 10413
                            )

                            )