how to use atk4 filestore file upload

2019-09-09 09:31发布

问题:

I'm having an issue using the atk4 filestore file upload.

I copied the fileadmin.php from the atk4-addons into my page directory and created the tables using a the filestore_001.sql script which created four tables.

I've added the following data to the filestore_type table

and the following to the filestore_volume table

I created a directory called upload in the webroot and tried with different permissions including 777 as a test to see if it was a permissions issue.

After selecting the local file to upload, it shows the uploading message where the text field was with the filename but when it completes, it displays an error indicating the model data was not loaded.

I suspect this is because the file wasnt uploaded successfully but i cant find any errors that indicate what went wrong apart from in the http response in firebug, i get the following

  <html><head><script>window.top.$('#paperless_fileadmin_form_Upload_test').atk4_uploader('uploadFailed',"Data was not loaded for paperless_fileadmin_form_Upload_test_controller_filestore_file_model_filestore_file_model_filestore_volume_2");
   </script></head></html>

The http post shows the file selected and the code does display an alert if the filetype is not one defined in filestore_filetype so that part of the controller is working.

Any suggestions on what is missing to get the file upload working ?

The output from turning on logging is as follows

  ------------------------------------------------------------
  Date: 29-Jun-2012 13:23:47
  Query String: page=fileadmin&submit=paperless_fileadmin_form&paperless_fileadmin_form_Upload_test_upload_action=paperless_fileadmin_form_Upload_test
  Referer: http://192.168.56.103/keep/paperless/?page=fileadmin
  Version: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1
  Port: 80
  ------------------------------------------------------------
  Stack trace
  /var/www/keep/paperless/atk4/lib/Form/Field/upload.php:98  Logger->logException(Object(Exception_InstanceNotLoaded))
  : Form_Field_Upload->loadPOST()
  /var/www/keep/paperless/atk4/lib/AbstractObject.php:303 call_user_func_array(Array(2), Array(0))
  /var/www/keep/paperless/atk4/lib/AbstractObject.php:294 AbstractObject->downCall("loadPOST", Array(0))
  /var/www/keep/paperless/atk4/lib/Form/Basic.php:333 AbstractObject->downCall("loadPOST")
  : Form_Basic->submitted()
  /var/www/keep/paperless/atk4/lib/AbstractObject.php:303 call_user_func_array(Array(2), Array(0))
  /var/www/keep/paperless/atk4/lib/AbstractObject.php:294 AbstractObject->downCall("submitted", Array(0))
  /var/www/keep/paperless/atk4/lib/AbstractObject.php:294 AbstractObject->downCall("submitted", Array(0))
  /var/www/keep/paperless/atk4/lib/ApiWeb.php:196 AbstractObject->downCall("submitted")
  /var/www/keep/paperless/index.php:15 ApiWeb->main()

and the output from the info.log is

  [29-Jun-2012 13:23:47] No data with id: 1 for: Model_Filestore_Volume but got no data. Query: select  filestore_volume.id, filestore_volume.name, filestore_volume.dirname, filestore_volume.total_space, filestore_volume.stored_files_cnt, filestore_volume.enabled, filestore_volume.id from filestore_volume filestore_volume  where (filestore_volume.id = '1')

And that solves the problem. I added the volume but then deleted it and added another one. This meant i had no filestore volume with ID=1 in the table, the ID is 3 as per screenshot above so i guess it's an issue in either the auto increment on filestore_volume, or how the filestore addon is looking to find volumes.