[TYPO3-core] RFC #10718: Make tce_file usable via AJAX

Dan Osipov dosipov at phillyburbs.com
Wed Mar 18 19:04:44 CET 2009


Benni,

I tried to do a quick test, but ran into an issue.
1) Uploading two files prior to the patch, works fine.
2) Uploading same two files after the patch - error message:
No files uploaded!

Files size exceeded? (8.0 M)
Messages:

You are not allowed to upload files!

You are not allowed to upload files!


Using DAM 1.1.1 to upload on 4.3 alpha2.

Ideas?

Dan Osipov
Calkins Media
http://danosipov.com/blog/

Benjamin Mack wrote:
> Hello everybody,
> 
> this is a SVN patch request.
> 
> Branches: trunk only
> 
> BT reference: http://bugs.typo3.org/view.php?id=10718
> 
> Problem:
> Right now, the tce_file "gateway" is a small script in 
> typo3/tce_file.php that handles all file operations, including the 
> upload function in the file list and the main backend. It is not 
> possible right now to call this file via AJAX in a clean way due to some 
> restrictions:
> 
> * typo3/tce_file.php includes the main class for handling the Get/post 
> data from outside as well as the execution of each task and the output 
> of error messages and a redirect after the execution of the file 
> operations.
>   Solution: To properly access the functions without executing the whole 
> process, the class should be put in a separate file 
> (typo3/classes/class.typo3_tcefile.php). We loose the XCLASSes but I 
> don't care so much in this case (it's not a main function, I don't know 
> a single extension that XCLASSes this class).
> 
> * Error messages that the "extfilefunctions" class writes to the DB 
> cannot be properly fetches (it's all in one method call, fetching and 
> HTML generation)
>   Solution: I added a new function to only fetch the errors from the DB 
> and moved that part out of the template generation part in extfilefunctions
> 
> * It is not possible to fetch the positive results from each 
> processData() call.
>   Solution: I introduced an array that summons these values and returns 
> them at the end of the "processData" call. This way the AJAX call can 
> e.g. return the final filename of the uploaded file.
> 
> * When using AJAX calls, we deal with Javascript (which always sends 
> UTF-8 requests and for us, also file names), so there is the need for a 
> charset conversion of the file uploads in extfilefunctions
>   Solution: This is now done via an additional key in the $cmdData array 
> of the uploading file (currently we have "data" and "target", now we add 
> "charset").
> 
> * I also introduced an AJAX call (tcefile::process) that makes use of 
> the new method in the class that does the same as the tce_file.php
> 
> 
> Notes:
> All in all, the patch should allow everything to behave as before, only 
> with some additions that are useful for alternative access of files 
> (yes, the mass uploader of course).
> Same goes for this patch as the one before: I want to deal with these 
> issues separately before I send the mass uploader so we can separate the 
> new feature from the general modifications that are needed.
> 
> All the best,
> Benni.
> 


More information about the TYPO3-team-core mailing list