Closed kevinresol closed 9 years ago
Out of curiosity - which target and server are you using?
PHP / Neko. Nekotools / mod_neko / mod_tora. Apache / Nginx etc.
nekotools server
does not handle multipart uploads correctly, so if that is what you are using I guess that might be the suspect.
I am using ufront s
for development purpose which should be nekotools server.
So, if I am using a regular production server like apache or nginx, what is the code to handle uploads with ufront? I opened the thread because I just dunno where to start with.
But just now I searched a bit the source code and found that there is a ufront.web.upload
package, I will look into that, thanks!
I'd recommend using this middleware:
http://api.ufront.net/ufront/web/upload/TmpFileUploadMiddleware.html
If it is a multipart request, it will save any files to a temporary file, and you can move it to where you want from there. You can access the uploaded files from context.request.files
.
I've only used file uploads in a couple of places, so let me know if you run into any road blocks.
I'll also try find out if there's a way we can give a better error message on nekotools server
... because it's pretty frustrating that it just crashes.
In fact, that is included by default in UfrontConfiguration
, so there's a good chance you have this already.
(p.s. I have no idea what approach will be best on the client side... If you have any ideas let me know)
Ok I will try to work with the uploadmiddleware and report any issue I found.
For client side, I am not very sure. Because I'm still quite new to client-side web apps and my mindset is still in the "client issue simple http request + server do all the stuff" era. Anyway I will post some issues if I got any new ideas.
But talking about client side, my main issue is that I wanted to make use of the controller but not to trigger a page/url change (by pushstate). Is that possible? For example, I have a "save" button which saves whatever data to server. Currently I add rel='pushstate'
to the button so that pushstate will intercept the click and direct to the corresponding controller which in turns calls some asyncApi. But in the same process the url is changed, even I return an EmptyResult so that the page doesn't change. So, for client-side, what I am now mainly looking for is a proper way to direct html element interactions to the UFcontrollers and provide feedback to the html elements once the controller completes execution.
Well I think that should be discussed in another thread
Seems the server just crashes when it receives some file upload requests